コード例 #1
0
        public void ComposeReturnsCorrectResult()
        {
            // Fixture setup
            var builder1 = new DelegatingSpecimenBuilder();
            var builder2 = new DelegatingSpecimenBuilder();
            var builder3 = new DelegatingSpecimenBuilder();

            var composer = new DelegatingComposer <object> {
                OnCompose = () => builder1
            };
            var behaviors = new[]
            {
                new DelegatingSpecimenBuilderTransformation {
                    OnTransform = b => b == builder1 ? builder2 : new DelegatingSpecimenBuilder()
                },
                new DelegatingSpecimenBuilderTransformation {
                    OnTransform = b => b == builder2 ? builder3 : new DelegatingSpecimenBuilder()
                }
            };

            var sut = new BehaviorComposer <object>(composer, behaviors);
            // Exercise system
            var result = sut.Compose();

            // Verify outcome
            Assert.Equal(builder3, result);
            // Teardown
        }
コード例 #2
0
        public void ComposeWithNoBehaviorsReturnsCorrectResult()
        {
            // Fixture setup
            var expectedBuilder = new DelegatingSpecimenBuilder();
            var composer        = new DelegatingComposer <object> {
                OnCompose = () => expectedBuilder
            };
            var sut = new BehaviorComposer <object>(composer);
            // Exercise system
            var result = sut.Compose();

            // Verify outcome
            Assert.Equal(expectedBuilder, result);
            // Teardown
        }
コード例 #3
0
 public void ComposeWithNoBehaviorsReturnsCorrectResult()
 {
     // Fixture setup
     var expectedBuilder = new DelegatingSpecimenBuilder();
     var composer = new DelegatingComposer<object> { OnCompose = () => expectedBuilder };
     var sut = new BehaviorComposer<object>(composer);
     // Exercise system
     var result = sut.Compose();
     // Verify outcome
     Assert.Equal(expectedBuilder, result);
     // Teardown
 }
コード例 #4
0
        public void ComposeReturnsCorrectResult()
        {
            // Fixture setup
            var builder1 = new DelegatingSpecimenBuilder();
            var builder2 = new DelegatingSpecimenBuilder();
            var builder3 = new DelegatingSpecimenBuilder();

            var composer = new DelegatingComposer<object> { OnCompose = () => builder1 };
            var behaviors = new[]
                {
                    new DelegatingSpecimenBuilderTransformation { OnTransform = b => b == builder1 ? builder2 : new DelegatingSpecimenBuilder() },
                    new DelegatingSpecimenBuilderTransformation { OnTransform = b => b == builder2 ? builder3 : new DelegatingSpecimenBuilder() }
                };

            var sut = new BehaviorComposer<object>(composer, behaviors);
            // Exercise system
            var result = sut.Compose();
            // Verify outcome
            Assert.Equal(builder3, result);
            // Teardown
        }