Moq |
ICallback..::.Callback<(Of <(T1, T2>)>) Method (<(Of <(T1, T2>)>)) |
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>( Action<T1, T2> callback ) |
Parameters
- callback
- Type: Action<(Of <(T1, T2>)>)
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.
Examples
Invokes the given callback with the concrete invocation arguments values.
Notice how the specific arguments are retrieved by simply declaring them as part of the lambda expression for the callback:
CopyC#
mock.Expect(x => x.Execute( It.IsAny<string>(), It.IsAny<string>())) .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));