







![]() |
Moq |
ICallback..::.Callback<(Of <(T1, T2, T3, T4>)>) Method (<(Of <(T1, T2, T3, T4>)>)) |
ICallback Interface Example See Also Send Feedback |
Specifies a callback to invoke when the method is called that receives the original
arguments.
Namespace:
Moq.Language
Assembly:
Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.0.0)
Syntax
C# |
---|
ICallbackResult Callback<T1, T2, T3, T4>( Action<T1, T2, T3, T4> callback ) |
Parameters
- callback
- Type: Action<(Of <(T1, T2, T3, T4>)>)
Callback method to invoke.
Type Parameters
- T1
- Type of the first argument of the invoked method.
- T2
- Type of the second argument of the invoked method.
- T3
- Type of the third argument of the invoked method.
- T4
- Type of the fourth argument of the invoked method.
Examples
Invokes the given callback with the concrete invocation arguments values.
CopyC#
Notice how the specific arguments are retrieved by simply declaring them as part of the lambda expression for the callback:

mock.Expect(x => x.Execute( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<bool>())) .Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));