Exemple #1
0
        public void Assert_with_function_call_should_remove_built_rule_from_fake_object()
        {
            // Arrange
            this.fakeObject.AddRule(this.ruleProducedByFactory);

            // Act
            var returnConfig = new RuleBuilder.ReturnValueConfiguration <int>()
            {
                ParentConfiguration = this.builder
            };

            returnConfig.Assert(Happened.Once);

            // Assert
            Assert.That(this.fakeObject.Rules, Is.Empty);
        }
Exemple #2
0
        public void Assert_with_function_call_should_assert_on_assertions_produced_by_factory()
        {
            // Arrange
            A.CallTo(() => this.ruleProducedByFactory.ToString()).Returns("call description");

            // Act
            var returnConfig = new RuleBuilder.ReturnValueConfiguration <int>()
            {
                ParentConfiguration = this.builder
            };

            returnConfig.Assert(Happened.Times(99).Exactly);

            // Assert
            var repeatMatcher = A <Func <int, bool> > .That.Matches(x => x.Invoke(99) == true);

            A.CallTo(() => this.asserter.AssertWasCalled(A <Func <IFakeObjectCall, bool> > .Ignored, "call description", repeatMatcher, "exactly #99 times")).Assert(Happened.Once);
        }