when using Typemock Isolator, always make sure to place an [Isolated] attribute at the class level (you can do this on a method level, but we encourage using it at the class level, since it applies to all tests in that class that way).
This attribute tells Typemock Isolator to “clean up” the various defined fake behaviors you have set in your tests so that they don’t “leak” out to other tests. for example, if you changed the behavior of a static method in one test (using Isolate.WhenCalled(type.SomeStaticMethod).. ), you don’t want other tests affected by this.
Placing the Isolated attribute at the method or class level makes sure any and all behaviors are reset at the end of a test method.
What if I use Isolator.Cleanup?
Isolater.CleanUp() is the same as placing the [Isolated] attribute but is an explicit call to reset behaviors. It’s part of the old typemock API and is discouraged except in specific edge cases (where you might need to cleanup behavior multiple times during one test, for example).
We encourage replacing Isolator.Cleanup with [Isolated] – since [Isolated] will also work for old typemock APIs (if you’re using MockManager, and RecorderManager, for example).