public override bool Perform(Invocation invocation) { if (Count == 0) { return(false); } //you would think it would be "if (CurrentExpectation.HasBeenMet)" but "atleast" matchers will have been met //when they can consume more, so increment after a match check //if (CurrentExpectation.HasBeenMet) if (!CurrentExpectation.Matches(invocation) && !invocation.MockObject.IgnoreUnexpectedInvocations) { current++; } //now if this one doesn't match then this is unexpected if (CurrentExpectation.Matches(invocation)) { var result = CurrentExpectation.Perform(invocation); //this helps for adding breakpoints and troubleshooting when returning false if (result) { return(true); } else { return(false); } } return(false); }
public override bool MatchesIgnoringIsActive(Invocation invocation) { if (CurrentExpectation == null) { return(false); } if (Count == 0) { return(false); } return(CurrentExpectation.MatchesIgnoringIsActive(invocation) || (CurrentExpectation.HasBeenMet && NextExpectationMatchesIgnoringIsActive(invocation))); //look ahead at the next if the current is an "atleast" matcher }