VerifyAll Method

Moq

Collapse image Expand Image Copy image CopyHover image
Verifies all expectations regardless of whether they have been flagged as verifiable.

Namespace: Moq
Assembly: Moq (in Moq.dll) Version: 4.0.10827.0 (4.0.0.0)

Syntax

C#
public 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>();
this.Setup(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.
this.VerifyAll();

Exceptions

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

See Also