chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male

How To Use The Isolated.Design Property

As you probably know by now, we’ve added a new Design property to the Isolated attribute.The Design property controls how the Isolate APsI work in different circumstances.

The default, implicit value, depends on the version of Isolator you’re using. In the free Basic version, the Design property is set to DesignMode.InterfaceOnly. In the Essential and Complete versions, it’s set to DesignMode.Pragmatic.

You can set the Design property explicitly, if you’re using a strict TDD development pattern. In that case, you want to work with interfaces or abstract classes, and want a notification when you step out of line.

In that case, you probably want to put it in the assembly level:


and that’s it. Every time your tests use something like:

You’ll immediately get a DesignModeException reminding you about that line you’ve crossed.

This can work very well if you’re in control of everything. But if you’re using a framework or a third party, that uses static types you might need to change the behavior in that scope. So if , for example, you have a test that checks for DateTime.Now, and you need to fake it, use something like this on the specific test:


PS did you know that IsolatedAttribute can be set on either assembly, class or method?

Gil Zilberfeld