LastCall

Allows to set options for the method calls. note: If the method has a return value, it’s recommended to use Expect

Summary
Allows to set options for the method calls.
Gets the method options for the last call for mockedInstance.
Internal!
Sets the return value when the method is called.
Throws the specified exception when the method is called.
Ignores the arguments for this method.
Allows to get the <Interfaces.IRepeat> instance that would allow to set the expected number of times that this method will occur.
Sets the contraints on this method parameters.
Sets a callback delegate to be called when this method is called.
Set an action to run when the expectation is matched.
Use the property as a normal property, so you can use it to save/load values without having to specify expectations for it.

Functions and Properties

On

Gets the method options for the last call for mockedInstance.  This is the recommended approach for multi threaded scenarios.

Expected usage

LastCall.On(mockObj).Return(4);

Thread safety

This method is safe to use in multi threading scenarios.

Options

Internal!

Get the method options for the last method call from all the mock objects.  Throws an exception if there is no such call.

Thread safety

Not safe for mutli threading, use On

Return

Sets the return value when the method is called.

Thread safety

Not safe for mutli threading, use <On>*

Throw

Throws the specified exception when the method is called.

Thread safety

Not safe for mutli threading, use On

IgnoreArguments

Ignores the arguments for this method.  Any arguments are considered fine for this method.

Thread safety

Not safe for mutli threading, use On

Repeat

Allows to get the <Interfaces.IRepeat> instance that would allow to set the expected number of times that this method will occur.

Thread safety

Not safe for mutli threading, use On

Constraints

Sets the contraints on this method parameters.  The number of the constraints must be equal to the number of method arguments.

Thread safety

Not safe for mutli threading, use On

Callback

Sets a callback delegate to be called when this method is called.

Important

The callback must have the same signature as the last method call but its return value must be a boolean.  The callback will be called with the same parameters as the method and the method will be accepted if the delegate return a positive value.  Note: The callback may be called several times

Thread safety

Not safe for mutli threading, use On

Do

Set an action to run when the expectation is matched.

Important

The action’s delegate must have the same signature as the last methdo call, and its return value must be assignable to the last method call return value.

Note

This method is only called once, after the method call was match to the expectation.

PropertyBehavior

Use the property as a normal property, so you can use it to save/load values without having to specify expectations for it.

Note

This can be called only when the last call is a getter or setter.

Allows to set expectation on methods that has return values.
Gets the method options for the last call for mockedInstance.