internal UnorderedCallAssertion(FakeManager fakeManager, ICallMatcher matcher, Action<IOutputWriter> callDescriber, CallCountConstraint callCountConstraint) { this.fakeManager = fakeManager; this.matcher = matcher; this.callDescriber = callDescriber; this.callCountConstraint = callCountConstraint; }
private UnorderedCallAssertion MustHaveHappened(CallCountConstraint callCountConstraint) { var asserter = this.asserterFactory.Invoke(this.Calls, this.manager.GetLastRecordedSequenceNumber()); asserter.AssertWasCalled(this.Matcher.Matches, this.RuleBeingBuilt.WriteDescriptionOfValidCall, callCountConstraint); return(new UnorderedCallAssertion(this.manager, this.Matcher, this.RuleBeingBuilt.WriteDescriptionOfValidCall, callCountConstraint)); }
public void Exception_message_should_not_contain_matching_call_when_call_is_recorded_after_checking_count() { var asserter = this.CreateAsserter(); // This will cause the call to be recorded after checking the count var callCountConstraintThatSimulatesALateArrivingCall = new CallCountConstraint(n => { this.StubCalls(1); return(false); }, "no match"); var exception = Record.Exception(() => asserter.AssertWasCalled(x => true, outputWriter => { }, callCountConstraintThatSimulatesALateArrivingCall)); exception.Should().BeAnExceptionOfType <ExpectationException>() .And.Message.Should().Contain("no calls were made to the fake object."); }