/// <summary> /// Returns the exception to be thrown when a setup limited by <see cref="IOccurrence.AtMost(int)"/> is matched more often than the specified maximum number of times. /// </summary> internal static MockException MoreThanNCalls(MethodCall setup, int maxInvocationCount, int invocationCount) { var message = new StringBuilder(); message.AppendLine(setup.FailMessage ?? "") .Append(Times.AtMost(maxInvocationCount).GetExceptionMessage(invocationCount)) .AppendLine(setup.Expression.ToStringFixed()); return(new MockException(MockExceptionReasons.MoreThanNCalls, message.ToString())); }
/// <summary> /// Returns the exception to be thrown when a setup limited by <see cref="IOccurrence.AtMost(int)"/> is invoked more often than the specified maximum number of times. /// </summary> internal static MockException MoreThanNCalls(MethodCall setup, int maxInvocationCount, int invocationCount) { return(new MockException( MockExceptionReason.MoreThanNCalls, Times.AtMost(maxInvocationCount).GetExceptionMessage(setup.FailMessage, setup.SetupExpression.ToStringFixed(), invocationCount))); }