







![]() |
Moq |
ICallback<(Of <(TResult>)>)..::.Callback Method () |
ICallback<(Of <(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: 2.6.1014.1 (2.6.0.0)
Syntax
C# |
---|
IReturnsThrows<TResult> Callback( Action callback ) |
Parameters
- callback
- Type: Action
Callback method to invoke.
Examples
The following example specifies a callback to set a boolean
value that can be used later:
CopyC#
Note that in the case of value-returning methods, after the Callback
call you can still specify the return value.

bool called = false; mock.Expect(x => x.Execute()) .Callback(() => called = true) .Returns(true);