Verifies that a specific invocation matching the given expression was performed on the mock, specifying a failure error message.

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

Syntax

C#
public void Verify<TResult>(
	Expression<Func<T, TResult>> expression,
	Times times,
	string failMessage
)

Parameters

expression
Type: Expression<(Of <(Func<(Of <(T, TResult>)>)>)>)
Expression to verify.
times
Type: Moq..::.Times
The number of times a method is allowed to be called.
failMessage
Type: String
Message to show if verification fails.

Type Parameters

TResult
Type of return value from the expression.

Exceptions

ExceptionCondition
Moq..::.MockException The invocation was not call the times specified by times.

See Also