Skip to content

Commit

Permalink
Additional Verify overload
Browse files Browse the repository at this point in the history
  • Loading branch information
bkijonka authored and kzu committed Jun 20, 2024
1 parent d465bf2 commit cc153db
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit cc153db

Please sign in to comment.