public void Check(IAssertionCall assertionCall, IMethodCallHistory methodCallHistory) { var matcher = assertionCall.ToMethodCallMatcher(); int matchingCallsCount = methodCallHistory .GetCalledMethods() .Where(matcher.MatchesCall) .Count(); if (matchingCallsCount != _times) { throw new SubstituteException( $"Expected *{_times}* call(s) matching assertion:\n" + $"\t{assertionCall.Describe()}\n" + $"but got *{matchingCallsCount}* matching calls."); } }
public void Check(IAssertionCall assertionCall, IMethodCallHistory methodCallHistory) { var anyArgsAssertionCall = new AnyArgumentsAssertionCall(assertionCall); var matcher = anyArgsAssertionCall.ToMethodCallMatcher(); int matchingCallsCount = methodCallHistory .GetCalledMethods() .Where(matcher.MatchesCall) .Count(); // TODO: Add proxy name and full method signature to error message. // Put signature at the end (to not clutter error message). if (matchingCallsCount == 0) { throw new SubstituteException( $"Expecting to receive at least a single call to method " + $"{anyArgsAssertionCall.Describe()} " + $"but none was received."); } }