A peculiar problem. I am trying out TypeMock with MsTest. Based on advice from your support I have switched over to using C# and AAA. Good advice by the way. I really like what I can do!
After having created about 150 test methods spread out over 10+ test files I can run all tests successfully if I run them one by one.
If I run "All tests in solution" about 12 test fails. If I just continue to click the "Run selected tests" in VS the failed tests will all pass without no other action. It looks like some interference between tests?
Which test fails changes when I add new tests or based on in which order I run the tests!
There is no common set up code in the test classes. All test methods are completely self contained.
I am testing a Model-View-Controller. The controller is a live object. The model in most cases is a live object and the viewer is faked.
In the most simple tests the test method simulates a user command from the faked viewer and the controller should update the status of the model. Like this sample:
public void ShowInputWindowTest()
IMainViewer fakeViewer = Isolate.Fake.Instance<IMainViewer>();
MainController controller = new MainController(fakeViewer);
AssessmentContext context = controller.Context;
Framework framework = new Framework();
Assessment assessment = new Assessment(framework);
EditSession session = new EditSession(null, assessment);
context.CurrentSession = session;
AssessmentSettings set = assessment.AssessmentSettings;
set.ShowInputWindow = false;
Isolate.Verify.WasCalledWithAnyArguments(() => fakeViewer.UpdateEditor(null, MainViewer.EditorUpdateMode.NewDisplayLayout));
Error message range from verification failed unexpected return value to exception null reference. Again if the test is rerun without any changes it will pass.
I do not understand what is happening and any help on how to debug further would be appreciated.