Exemplo n.º 1
0
        public void TestBuildFromPrioritizedList__Only()
        {
            INodeDataMapperBuilder builder1 = Substitute.For <INodeDataMapperBuilder>();
            INodeDataMapper        mapper   = Substitute.For <INodeDataMapper>();

            builder1.CanBuild.Returns(true);
            builder1.BuildMapper().Returns(mapper);

            Assert.Same(mapper, builder.BuildFromPrioritizedList(builder1));

            builder1.Received().BuildMapper();
        }
Exemplo n.º 2
0
        public void TestBuildFromPrioritizedList__Last()
        {
            INodeDataMapperBuilder builder1 = Substitute.For <INodeDataMapperBuilder>();
            INodeDataMapperBuilder builder2 = Substitute.For <INodeDataMapperBuilder>();
            INodeDataMapperBuilder builder3 = Substitute.For <INodeDataMapperBuilder>();

            builder1.CanBuild.Returns(false);
            builder2.CanBuild.Returns(false);
            builder3.CanBuild.Returns(true);

            INodeDataMapper mapper = Substitute.For <INodeDataMapper>();

            builder3.BuildMapper().Returns(mapper);

            Assert.Same(mapper, builder.BuildFromPrioritizedList(builder1, builder2, builder3));

            builder1.DidNotReceive().BuildMapper();
            builder2.DidNotReceive().BuildMapper();
            builder3.Received().BuildMapper();
        }