Verifies that all verifiable expectations have been met.
Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)
Syntax
C# |
---|
public void Verify() |
Examples
This example sets up an expectation and marks it as verifiable. After
the mock is used, a Verify() call is issued on the mock
to ensure the method in the setup was invoked:
CopyC#
var mock = new Mock<IWarehouse>(); this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); ... // other test code ... // Will throw if the test code has didn't call HasInventory. this.Verify();
Exceptions
Exception | Condition |
---|---|
Moq..::..MockException | Not all verifiable expectations were met. |