public static T ReceivedNoCalls <T>(this T substitute, ReceivedCallsConstraint receivedCallsConstraint) where T : class { if (substitute.ReceivedCalls().Any(receivedCallsConstraint.FailWhenMatched)) { var message = ReceivedMessages.ReceivedNoCallsMatchingPredicateMessageFor(substitute, receivedCallsConstraint.FailWhenMatched, receivedCallsConstraint.ConstraintDescription); throw new CallSequenceNotFoundException(message); } return(substitute); }