







![]() |
Moq |
ICallback..::..Callback<(Of <(<'T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)>)> Method (Action<(Of <(<'T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)>)>) |
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: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
ICallbackResult Callback<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>( Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action ) |
Parameters
- action
- Type: System..::..Action<(Of <(<'T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>)>)>
The callback method to invoke.
Type Parameters
- T1
- The type of the first argument of the invoked method.
- T2
- The type of the second argument of the invoked method.
- T3
- The type of the third argument of the invoked method.
- T4
- The type of the fourth argument of the invoked method.
- T5
- The type of the fifth argument of the invoked method.
- T6
- The type of the sixth argument of the invoked method.
- T7
- The type of the seventh argument of the invoked method.
- T8
- The type of the eighth argument of the invoked method.
- T9
- The type of the nineth argument of the invoked method.
- T10
- The type of the tenth argument of the invoked method.
- T11
- The type of the eleventh argument of the invoked method.
- T12
- The type of the twelfth argument of the invoked method.
- T13
- The type of the thirteenth argument of the invoked method.
- T14
- The type of the fourteenth argument of the invoked method.
- T15
- The type of the fifteenth argument of the invoked method.
Return Value
A reference to ICallbackResult interface.
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.Setup(x => x.Execute( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));