Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
0
        public void ShouldThrowExceptionWhenTypeChainCannotBeFound()
        {
            //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().DependOnTypeChain(decorator2.GetType(), decorator3.GetType(), decorator1.GetType());
            })
            .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)]");
        }