![Collapse image Collapse image](collapse_all.gif)
![Expand Image Expand Image](expand_all.gif)
![](collapse_all.gif)
![](expand_all.gif)
![](dropdown.gif)
![](dropdownHover.gif)
![Copy image Copy image](icons/copycode.gif)
![CopyHover image CopyHover image](copycodeHighlight.gif)
Specifies a callback to invoke when the method is called.
Namespace: Moq.Language
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
ICallbackResult Callback( Action action ) |
Parameters
- action
- Type: System..::..Action
The callback method to invoke.
Examples
The following example specifies a callback to set a boolean
value that can be used later:
CopyC#
![](CopyCode.gif)
var called = false; mock.Setup(x => x.Execute()) .Callback(() => called = true);