IMockControl Methods

Typemock Isolator Developer Guide

The IMockControl type exposes the following members.

Methods

  NameDescription
Public methodAlwaysCallOriginal
Indicate that the behavior of the mocked method will be to call the original method.
Public methodAlwaysReturn
Expect unlimited calls from method, and always returns mock value
Public methodAlwaysThrow
Expect unlimited calls from method, and always throws exception
Public methodCode exampleAnonymousMethodOf
Use to mock all anonymous methods that are called from within a method
Public methodCode exampleAssignField
Assign a new value to the given field.
Public methodClear
Clear all expectations
Public methodClear(String)
Clear expectation of a method
Public methodExpectAddEvent(String)
Expect 1 event listener to be added (event += new EventHandler())
Public methodExpectAddEvent(String, Int32)
Expect a number of event listeners to be added (event += new EventHandler())
Public methodExpectAddEventAlways
Expect unlimited number of event listeners to be added (event += new EventHandler())
Public methodExpectAlways
Expect unlimited calls from method
Public methodExpectAndReturn(String, Object, Type)
Expect 1 call from method, and mock return value
Public methodExpectAndReturn(String, Object, Int32, Type)
Expect a number of calls from method, and mock return value
Public methodExpectAndThrow(String, Exception, Type)
Expect 1 call from method, and mock throwing an exception
Public methodExpectAndThrow(String, Exception, Int32, Type)
Expect a number of calls from method, and mock throwing an exception
Public methodExpectCall(String, Type)
Expect 1 call from method
Public methodExpectCall(String, Int32, Type)
Expect a number of calls from method
Public methodExpectConstructor
Mock Constructor
Public methodExpectConstructor(Int32)
Mock Constructor
Public methodExpectConstructorAlways
Mock unlimited calls from Constructor
Public methodExpectConstructorAndThrow
Mock Constructor and throw exception when constructor is called
Public methodExpectGet(String, Object)
Expect 1 get of a Property and mock the Property's value
Public methodExpectGet(String, Object, Int32)
Expect a number of gets of a Property and mock the Property's value
Public methodExpectGetAlways
Expect unlimited get of a Property and always mock the Property's value
Public methodExpectGetAndAlwaysThrow
Expect unlimited get of a Property and always mock throwing an exception
Public methodExpectGetAndThrow(String, Exception)
Expect 1 get of a Property and mock throwing an exception
Public methodExpectGetAndThrow(String, Exception, Int32)
Expect a number of gets of a Property and mock throwing an exception
Public methodExpectGetIndex(Object)
Expect 1 get of an Index and mock the index value
Public methodExpectGetIndex(Object, Int32)
Expect a number of get of an Index and mock the index value
Public methodExpectGetIndexAlways
Expect unlimited set of an Index and mock throwing an exception
Public methodExpectGetIndexAndAlwaysThrow
Expect unlimited set of an Index and mock throwing an exception
Public methodExpectGetIndexAndThrow(Exception)
Expect 1 get of an Index and mock throwing an exception
Public methodExpectGetIndexAndThrow(Exception, Int32)
Expect a number of gets of an Index and mock throwing an exception
Public methodExpectRemoveEvent(String)
Expect 1 event listener to be removed (event -= new EventHandler())
Public methodExpectRemoveEvent(String, Int32)
Expect a number of event listeners to be removed (event -= new EventHandler())
Public methodExpectSet(String)
Expect 1 set of a Property
Public methodExpectSet(String, Int32)
Expect a number of sets of a Property
Public methodExpectSetAlways
Expect unlimited set of a Property
Public methodExpectSetAndAlwaysThrow
Expect unlimited set of a Property and always mock throwing an exception
Public methodExpectSetAndThrow(String, Exception)
Expect 1 set of a Property and mock throwing an exception
Public methodExpectSetAndThrow(String, Exception, Int32)
Expect a number of sets of a Property and mock throwing an exception
Public methodExpectSetIndex
Expect 1 set of an Index
Public methodExpectSetIndex(Int32)
Expect a number of sets of an Index
Public methodExpectSetIndexAlways
Expect unlimited set of an Index
Public methodExpectSetIndexAndAlwaysThrow
Expect unlimited set of an Index and mock throwing an exception
Public methodExpectSetIndexAndThrow(Exception)
Expect 1 set of an Index and mock throwing an exception
Public methodExpectSetIndexAndThrow(Exception, Int32)
Expect a number of sets of an Index and mock throwing an exception
Public methodExpectUnmockedCall(String, Type)
Verify 1 call from method , continue with method as normal
Public methodExpectUnmockedCall(String, Int32, Type)
Verify a number of calls from method , continue with method as normal
Public methodExpectUnmockedConstructor
Don't Mock Constructor but verify arguments
Public methodExpectUnmockedConstructor(Int32)
Don't Mock Constructor but verify arguments
Public methodExpectUnmockedGet(String)
Verify 1 get of a Property , continue with get method as normal
Public methodExpectUnmockedGet(String, Int32)
Verify a number of gets of a Property , continue with get method as normal
Public methodExpectUnmockedSet(String)
Verify 1 set of a Property , continue with set method as normal
Public methodExpectUnmockedSet(String, Int32)
Verify a number of sets of a Property , continue with set method as normal
Public methodMethodSettings
Perform Behavior tweaking on methods rather then the whole mocked type
Public methodMethodSettingsGetIndex
Perform Behavior tweaking on methods rather then the whole mocked type
Public methodMethodSettingsGetProperty
Perform Behavior tweaking on methods rather then the whole mocked type
Public methodMethodSettingsSetIndex
Perform Behavior tweaking on methods rather then the whole mocked type
Public methodMethodSettingsSetProperty
Perform Behavior tweaking on methods rather then the whole mocked type
Public methodCode exampleMockField
Create a Mock object and assign it to a given field.
Top
See Also

Reference