SetupSet Method (Action(T))

Moq

Collapse image Expand Image Copy image CopyHover image
Specifies a setup on the mocked type for a call to to a property setter.

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

Syntax

C#
public ISetup<T> SetupSet(
	Action<T> setterExpression
)

Parameters

setterExpression
Type: System..::..Action<(Of <(<'T>)>)>
Lambda expression that sets a property to a value.

Remarks

If more than one setup is set for the same property setter, the latest one wins and is the one that will be executed.

Examples

CopyC#
mock.SetupSet(x => x.Suspended = true);

See Also