IMockControl is the Typemock Isolator mock type controller, this interface is use for managing the
virtual mocks
Namespace: TypeMock
Assembly: TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax
The IMockControl type exposes the following members.
Properties
Name | Description | |
---|---|---|
![]() | CallBase |
Allow mocking a method in a base class that is hidden by the mocked class
|
![]() | ValidateArgsOnVerify | Obsolete.
Obsolete. Argument validation is done both on calling the method and during Verify.
Postpone throwing validation errors till Verify is called
|
Methods
Name | Description | |
---|---|---|
![]() | AlwaysCallOriginal |
Indicate that the behavior of the mocked method will be to call the original method.
|
![]() | AlwaysReturn |
Expect unlimited calls from method, and always returns mock value
|
![]() | AlwaysThrow |
Expect unlimited calls from method, and always throws exception
|
![]() ![]() | AnonymousMethodOf |
Use to mock all anonymous methods that are called from within a method
|
![]() ![]() | AssignField |
Assign a new value to the given field.
|
![]() | Clear |
Clear all expectations
|
![]() | Clear(String) |
Clear expectation of a method
|
![]() | ExpectAddEvent(String) |
Expect 1 event listener to be added (event += new EventHandler())
|
![]() | ExpectAddEvent(String, Int32) |
Expect a number of event listeners to be added (event += new EventHandler())
|
![]() | ExpectAddEventAlways |
Expect unlimited number of event listeners to be added (event += new EventHandler())
|
![]() | ExpectAlways |
Expect unlimited calls from method
|
![]() | ExpectAndReturn(String, Object, Type) |
Expect 1 call from method, and mock return value
|
![]() | ExpectAndReturn(String, Object, Int32, Type) |
Expect a number of calls from method, and mock return value
|
![]() | ExpectAndThrow(String, Exception, Type) |
Expect 1 call from method, and mock throwing an exception
|
![]() | ExpectAndThrow(String, Exception, Int32, Type) |
Expect a number of calls from method, and mock throwing an exception
|
![]() | ExpectCall(String, Type) |
Expect 1 call from method
|
![]() | ExpectCall(String, Int32, Type) |
Expect a number of calls from method
|
![]() | ExpectConstructor |
Mock Constructor
|
![]() | ExpectConstructor(Int32) |
Mock Constructor
|
![]() | ExpectConstructorAlways |
Mock unlimited calls from Constructor
|
![]() | ExpectConstructorAndThrow |
Mock Constructor and throw exception when constructor is called
|
![]() | ExpectGet(String, Object) |
Expect 1 get of a Property and mock the Property's value
|
![]() | ExpectGet(String, Object, Int32) |
Expect a number of gets of a Property and mock the Property's value
|
![]() | ExpectGetAlways |
Expect unlimited get of a Property and always mock the Property's value
|
![]() | ExpectGetAndAlwaysThrow |
Expect unlimited get of a Property and always mock throwing an exception
|
![]() | ExpectGetAndThrow(String, Exception) |
Expect 1 get of a Property and mock throwing an exception
|
![]() | ExpectGetAndThrow(String, Exception, Int32) |
Expect a number of gets of a Property and mock throwing an exception
|
![]() | ExpectGetIndex(Object) |
Expect 1 get of an Index and mock the index value
|
![]() | ExpectGetIndex(Object, Int32) |
Expect a number of get of an Index and mock the index value
|
![]() | ExpectGetIndexAlways |
Expect unlimited set of an Index and mock throwing an exception
|
![]() | ExpectGetIndexAndAlwaysThrow |
Expect unlimited set of an Index and mock throwing an exception
|
![]() | ExpectGetIndexAndThrow(Exception) |
Expect 1 get of an Index and mock throwing an exception
|
![]() | ExpectGetIndexAndThrow(Exception, Int32) |
Expect a number of gets of an Index and mock throwing an exception
|
![]() | ExpectRemoveEvent(String) |
Expect 1 event listener to be removed (event -= new EventHandler())
|
![]() | ExpectRemoveEvent(String, Int32) |
Expect a number of event listeners to be removed (event -= new EventHandler())
|
![]() | ExpectSet(String) |
Expect 1 set of a Property
|
![]() | ExpectSet(String, Int32) |
Expect a number of sets of a Property
|
![]() | ExpectSetAlways |
Expect unlimited set of a Property
|
![]() | ExpectSetAndAlwaysThrow |
Expect unlimited set of a Property and always mock throwing an exception
|
![]() | ExpectSetAndThrow(String, Exception) |
Expect 1 set of a Property and mock throwing an exception
|
![]() | ExpectSetAndThrow(String, Exception, Int32) |
Expect a number of sets of a Property and mock throwing an exception
|
![]() | ExpectSetIndex |
Expect 1 set of an Index
|
![]() | ExpectSetIndex(Int32) |
Expect a number of sets of an Index
|
![]() | ExpectSetIndexAlways |
Expect unlimited set of an Index
|
![]() | ExpectSetIndexAndAlwaysThrow |
Expect unlimited set of an Index and mock throwing an exception
|
![]() | ExpectSetIndexAndThrow(Exception) |
Expect 1 set of an Index and mock throwing an exception
|
![]() | ExpectSetIndexAndThrow(Exception, Int32) |
Expect a number of sets of an Index and mock throwing an exception
|
![]() | ExpectUnmockedCall(String, Type) |
Verify 1 call from method , continue with method as normal
|
![]() | ExpectUnmockedCall(String, Int32, Type) |
Verify a number of calls from method , continue with method as normal
|
![]() | ExpectUnmockedConstructor |
Don't Mock Constructor but verify arguments
|
![]() | ExpectUnmockedConstructor(Int32) |
Don't Mock Constructor but verify arguments
|
![]() | ExpectUnmockedGet(String) |
Verify 1 get of a Property , continue with get method as normal
|
![]() | ExpectUnmockedGet(String, Int32) |
Verify a number of gets of a Property , continue with get method as normal
|
![]() | ExpectUnmockedSet(String) |
Verify 1 set of a Property , continue with set method as normal
|
![]() | ExpectUnmockedSet(String, Int32) |
Verify a number of sets of a Property , continue with set method as normal
|
![]() | MethodSettings |
Perform Behavior tweaking on methods rather then the whole mocked type
|
![]() | MethodSettingsGetIndex |
Perform Behavior tweaking on methods rather then the whole mocked type
|
![]() | MethodSettingsGetProperty |
Perform Behavior tweaking on methods rather then the whole mocked type
|
![]() | MethodSettingsSetIndex |
Perform Behavior tweaking on methods rather then the whole mocked type
|
![]() | MethodSettingsSetProperty |
Perform Behavior tweaking on methods rather then the whole mocked type
|
![]() ![]() | MockField | Create a Mock object and assign it to a given field. |
Remarks
- Set Up - This is the stage where you 'record' what the mocked type/object expects to do and what to return
- Run - Run the actual class under test
- Verify - Make sure that the mocked object acted as expected
These phases are managed by the IMockControl object.
![]() |
---|
You cannot create an IMockControl directly use MockManager.Mock(Type) or MockManager.MockObject(Type, Object) |
![]() |
---|
When mocking a method that is declared in a base class, Typemock Isolator will only mock that method when called from the mocked type. When a base method is mocked and a derived class calls that method, it WON'T be mocked |
See Also