Ejemplo n.º 1
0
 internal UnorderedCallAssertion(FakeManager fakeManager, ICallMatcher matcher, Action<IOutputWriter> callDescriber, CallCountConstraint callCountConstraint)
 {
     this.fakeManager = fakeManager;
     this.matcher = matcher;
     this.callDescriber = callDescriber;
     this.callCountConstraint = callCountConstraint;
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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.");
        }