I have an odd case where I have multiple tests running on the same class. For most of these tests I am mocking a method on the class to return controlled results. One of the tests actually uses the normal version of the method. When the test that uses the concrete version of the method call runs first then I am unable to mock the method in the other tests.
Here is some example code depicting my issue:
In the code above, first will actually call the method rather than using the mock. Is this a bug? It seems like a bug. Is there a work around?
Here is some example code depicting my issue:
var first =
new
MyClass();
var second =
new
MyClass();
second.DoSomething();
Mock.Arrange(() => first.DoSomething()).Returns(
new
List<IDataItem>);
first.DoSomething();
In the code above, first will actually call the method rather than using the mock. Is this a bug? It seems like a bug. Is there a work around?