Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Verify overload #1463

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Moq/Mock`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,22 @@ public void Verify<TResult>(Expression<Func<T, TResult>> expression, Func<Times>
Mock.Verify(this, expression, times(), null);
}

/// <summary>
/// Verifies that a specific invocation matching the given expression was performed on the mock,
/// specifying a failure error message.
/// </summary>
/// <param name="expression">Expression to verify.</param>
/// <param name="times">The number of times a method is expected to be called.</param>
/// <param name="failMessage">Message to show if verification fails.</param>
/// <typeparam name="TResult">Type of return value from the expression.</typeparam>
/// <exception cref="MockException">
/// The invocation was not called the number times specified by <paramref name="times"/>.
/// </exception>
public void Verify<TResult>(Expression<Func<T, TResult>> expression, Func<Times> times, string failMessage)
{
Mock.Verify(this, expression, times(), failMessage);
}

/// <summary>
/// Verifies that a specific invocation matching the given expression was performed on the mock,
/// specifying a failure error message.
Expand Down