Behavior of the Mocking API Methods
The following methods throw a DesignModeException when you call them with the Design property set to InterfaceOnly:
• Isolate.Fake.StaticMethods()
• Isolate.Fake.StaticConstructor()
• All Isolate.NonPublic methods
• All Isolate.Swap methods
In addition, the following methods throw a DesignModeException within conditions:
Methods |
Condition |
Behavior |
Throws Exception When... |
Isolate.Fake.Instance<T> |
T has some or all virtual methods |
Only virtual methods can be faked and verified.
|
T is a sealed object All methods are non-virtual. |
Isolate.Fake.Dependencies<T> |
All argument types of T’s constructors have some virtual methods |
Arguments are faked as with Fake.Instance<>. Object is created and returned. |
All dependencies are sealed or have only non-virtual methods. |
Isolate.WhenCalled… |
Virtual methods |
Can set any behavior |
Called on non-virtual methods |
Isolate.Verify… |
Virtual methods |
Can verify the behavior |
Called on non-virtual methods |