Moq |
ICallback<(Of <(<'TMock, TResult>)>)>..::..Callback Method (Action) |
ICallback<(Of <(<'TMock, TResult>)>)> Interface Example See Also Send Feedback |
Specifies a callback to invoke when the method is called.
Namespace: Moq.Language
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
IReturnsThrows<TMock, TResult> Callback( Action action ) |
Parameters
- action
- Type: System..::..Action
The callback method to invoke.
Examples
The following example specifies a callback to set a boolean value that can be used later:
Note that in the case of value-returning methods, after the Callback
call you can still specify the return value.
CopyC#
var called = false; mock.Setup(x => x.Execute()) .Callback(() => called = true) .Returns(true);