VerifyAll Method

Moq 2.6

Verifies all expectations regardless of whether they have been flagged as verifiable.

Namespace:  Moq
Assembly:  Moq (in Moq.dll) Version: 2.6.1014.1 (2.6.0.0)

Syntax

C#
void VerifyAll()

Examples

This example sets up an expectation without marking it as verifiable. After the mock is used, a VerifyAll()()() call is issued on the mock to ensure that all expectations are met:
CopyC#
var mock = new Mock<IWarehouse>();
mock.Expect(x => x.HasInventory(TALISKER, 50)).Returns(true);
...
// other test code
...
// Will throw if the test code has didn't call HasInventory, even 
// that expectation was not marked as verifiable.
mock.VerifyAll();

Exceptions

Exception Condition
Moq..::.MockException At least one expectation was not met.

See Also