







Verifies that all verifiable expectations have been met.
Namespace:
Moq
Assembly:
Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.0.0)
Syntax
C# |
---|
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 expectation was invoked:
CopyC#

var mock = new Mock<IWarehouse>(); mock.Expect(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true); ... // other test code ... // Will throw if the test code has didn't call HasInventory. mock.Verify();
Exceptions
Exception | Condition |
---|---|
Moq..::.MockException | Not all verifiable expectations were met. |