The Mock type exposes the following members.

Constructors

  NameDescription
Mock
Constructer, keep internal

Methods

  NameDescription
AlwaysCallOriginal
Sets the expectaion of this method to always call the original method.
AlwaysReturnOverloaded.
AlwaysThrowOverloaded.
AnonymousMethodOf
Use to mock all anonymous methods that are called from within a method
AssignField
Assign a new value to the given field.
ChangeConstructor
Constructer swaping with the mocked one, keep internal
ClearOverloaded.
EndBlock
End an expectation block
ExpectAddEventOverloaded.
ExpectAddEventAlways
Expect unlimited number of event listeners to be added (event += new EventHandler())
ExpectAlways
Expect unlimited calls from method
ExpectAndReturnOverloaded.
ExpectAndThrowOverloaded.
ExpectCallOverloaded.
ExpectCallAndVerify Obsolete.
Verify 1 call from method , continue with method as normal
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.
GetBlock
Retrieve Expectation Block, by its label name
GetCallCountOverloaded.
GetCallIndexerCounter
Return the amount of times an indexer has been called
GetCallPropertyGetCounter
Return the amount of times a property has been called
GetCallPropertySetCounter
Return the amount of times a property has been set
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
MockConstructor Obsolete.
Mock Constructor
MockField
Create a Mock object and assign it to a given field.
RemoveStaticCtor
Remobing static constructer, keep internal
StartBlockOverloaded.
StartBlockBeforeOverloaded.
Verify
Verify mocked type
VerifyWithTimeoutOverloaded.

Properties

  NameDescription
CallBase
Allow mocking a method in a base class that is hidden by the mocked class
CallStatic
Allow mocking a static method when that method is overloaded with an instance method

Remarks

In most cases there is no need to use this method as Typemock Isolator will mock all static methods of the mocked type. CallStatic should be used when an instance method and a static method have the same name By default the instance methods are returned.
If instance methods are mocked
MockedInstance
Get the actual instance that is being mocked and controlled. This enables tracking instance mocks to the actual instance
MockedType
Get the type that is mocked and controlled.
Strict
Can set the mock to be Strict The default is the Methods of Abstract and Interfaces are Strict and Arbitrary calls fail while Arbitrary Methods of concrete classes are allowed.
StrictStatic
Can set the static methods of a mocked type to be Strict
ValidateArgsOnVerify Obsolete.
Obslolete. Argument validation is done both on calling the method and during Verify.

Events

  NameDescription
MockMethodCalled
Event that is fired after a mocked method is called and after argument validation is performed MockMethodCalledEventHandler

See Also