The IMockControl type exposes the following members.

Methods

  NameDescription
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.
ClearOverloaded.
ExpectAddEventOverloaded.
ExpectAddEventAlways
Expect unlimited number of event listeners to be added (event += new EventHandler())
ExpectAlways
Expect unlimited calls from method
ExpectAndReturnOverloaded.
ExpectAndThrowOverloaded.
ExpectCallOverloaded.
ExpectConstructorOverloaded.
ExpectConstructorAlways
Mock unlimited calls from Constructor
ExpectConstructorAndThrow
Mock Constructor and throw exception when constructor is called
ExpectGetOverloaded.
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
ExpectGetAndThrowOverloaded.
ExpectGetIndexOverloaded.
ExpectGetIndexAlways
Expect unlimited set of an Index and mock throwing an exception
ExpectGetIndexAndAlwaysThrow
Expect unlimited set of an Index and mock throwing an exception
ExpectGetIndexAndThrowOverloaded.
ExpectRemoveEventOverloaded.
ExpectSetOverloaded.
ExpectSetAlways
Expect unlimited set of a Property
ExpectSetAndAlwaysThrow
Expect unlimited set of a Property and always mock throwing an exception
ExpectSetAndThrowOverloaded.
ExpectSetIndexOverloaded.
ExpectSetIndexAlways
Expect unlimited set of an Index
ExpectSetIndexAndAlwaysThrow
Expect unlimited set of an Index and mock throwing an exception
ExpectSetIndexAndThrowOverloaded.
ExpectUnmockedCallOverloaded.
ExpectUnmockedConstructorOverloaded.
ExpectUnmockedGetOverloaded.
ExpectUnmockedSetOverloaded.
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.

Properties

  NameDescription
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

See Also