Verifies that all verifiable expectations have been met.
Namespace:
MoqAssembly: Moq (in Moq.dll) Version: 2.5.1.153 (2.5.1.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. |