Example #1
0
        public void ShouldBeAbleToAssertOnDependencyObjectChainsSuccessfully()
        {
            //GIVEN
            var decorator4 = new Decorator4();
            var decorator3 = new Decorator3(decorator4);
            var decorator2 = new Decorator2(decorator3);

            //WHEN
            var decorator1 = new Decorator1(decorator2);

            //THEN
            decorator1.Should().DependOnChain(decorator2, decorator3).And.DependOnChain(decorator2, decorator3, decorator4);
        }
Example #2
0
        public void ShouldBeAbleToAssertOnDependencyTypeChainsSuccessfully()
        {
            //GIVEN
            var decorator4 = new Decorator4();
            var decorator3 = new Decorator3(decorator4);
            var decorator2 = new Decorator2(decorator3);

            //WHEN
            var decorator1 = new Decorator1(decorator2);

            //THEN
            decorator1.Should().DependOnTypeChain(decorator2.GetType(), decorator3.GetType());
            decorator1.Should().DependOnTypeChain(decorator2.GetType(), decorator3.GetType(), decorator4.GetType());
        }
Example #3
0
        public void ShouldThrowExceptionWhenChainCannotBeFound()
        {
            //GIVEN
            var decorator4 = new Decorator4();
            var decorator3 = new Decorator3(decorator4);
            var decorator2 = new Decorator2(decorator3);

            //WHEN
            var decorator1 = new Decorator1(decorator2);

            //THEN
            new Action(() => { decorator1.Should().DependOnChain(decorator2, decorator3, decorator1); })
            .Should().ThrowExactly <XunitException>()
            .WithMessage(
                @"Could not find the particular sequence of objects: [TddXt.XFluentAssert.EndToEndSpecification.XAssertSpecifications.Decorator2, TddXt.XFluentAssert.EndToEndSpecification.XAssertSpecifications.Decorator3, TddXt.XFluentAssert.EndToEndSpecification.XAssertSpecifications.Decorator1] anywhere in dependency graph. Paths searched:
 [Root(Decorator1)]->[_decorator(Decorator2)]->[_decorator3(Decorator3)]->[_decorator4(Decorator4)]");
        }