Hi,
It seems that isolated attribute clears the fakes when exiting the test method.
I think it should clear the fakes at the end of the teardown.
the following example demonstrate such a failure:
[TestClass]
[Isolated]
public class IsolatedBeforeTearDown
{
static UnderTest target;
[TestInitialize]
public void Setup()
{
target = new UnderTest();
Isolate.WhenCalled(() => target.ReturnFive()).WillReturn(6);
}
[TestCleanup]
public void TearDown()
{
Assert.AreEqual(6, target.ReturnFive());
}
[TestMethod]
public void bTest()
{
Assert.AreEqual(6, target.ReturnFive());
}
}
And while we are on it, it appears that the Isolated attribute can decorate other methods and not only test methods.
I don't think that was what the intended meaning of the attribute was
(We just spend two hours worth of debugging just because someone put it on top of the setup method...)
I think the two things related, and if you can cause the fakes to be clean at the end of the test (and not the test method) it would solve both issues.