[This is preliminary documentation and is subject to change.]

Specifies a callback to invoke when the method is called.

Namespace:  Moq
Assembly:  Moq (in Moq)
Version: 1.5.2951.38938 (1.5.0.0)

Syntax

C#
ICall Callback(
	Action callback
)

Parameters

callback
Type: System..::.Action
Callback method to invoke.

Examples

The following example specifies a callback to set a boolean value that can be used later:
CopyC#
bool called = false;
mock.Expect(x => x.Execute()).Callback(() => called = true);

See Also