Callback Method

Moq

Collapse image Expand Image Copy image CopyHover image
Specifies a callback to invoke when the property is retrieved.

Namespace: Moq.Language
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)

Syntax

C#
IReturnsThrowsGetter<TMock, TProperty> Callback(
	Action action
)

Parameters

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

Examples

Invokes the given callback with the property value being set.
CopyC#
mock.SetupGet(x => x.Suspended)
    .Callback(() => called = true)
    .Returns(true);

See Also