Interested in a
Personal Demo ?


Name* :
Please Enter your Name
Company E–Mail* :
Please Enter a Valid Email

Testimonials


With Typemock we don’t have to rewrite product code specifically for testing purposes. This not only saves time, it also allows us to test components of our product code that cannot be readily changed, enabling comprehensive testing and overall high quality.
Travis Illig, Senior Software Engineer, Digital Channels, Fiserv
Success stories

PurchaseOptions


US Toll Free
866–895–4680
Outside US
+44–203–150–0293
Get your printable quote
Buy online

 

Missing [Isolated] Attribute on tests

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).