Moq |
Mock<(Of <(<'T>)>)>..::..VerifySet Method (Action<(Of <(<'T>)>)>, String) |
Mock<(Of <(<'T>)>)> Class Example See Also Send Feedback |
Verifies that a property was set on the mock, specifying
a failure message.
Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
Parameters
- setterExpression
- Type: System..::..Action<(Of <(<'T>)>)>
Expression to verify.
- failMessage
- Type: System..::..String
Message to show if verification fails.
Examples
This example assumes that the mock has been used,
and later we want to verify that a given property
was set on it:
CopyC#
var mock = new Mock<IWarehouse>(); // exercise mock //... // Will throw if the test code didn't set the IsClosed property. mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action");
Exceptions
Exception | Condition |
---|---|
Moq..::..MockException | The invocation was not performed on the mock. |