public void WithExplicitValueReturnsCorrectResult(string value)
        {
            // Fixture setup
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <PropertyHolder <string> >(node);
            // Exercise system
            var actual = sut.With(x => x.Property, value);
            // Verify outcome
            var expected = new CompositeNodeComposer <PropertyHolder <string> >(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >().With(x => x.Property, value),
                    SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >().With(x => x.Property, value),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
            // Teardown
        }
        public void WithSingleArgValueFactoryReturnsCorrectResult(string value)
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <PropertyHolder <string> >(node);
            Func <string, string> valueFactory = _ => value;
            // Act
            var actual = sut.With(x => x.Property, valueFactory);
            // Assert
            var expected = new CompositeNodeComposer <PropertyHolder <string> >(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >().With(x => x.Property, valueFactory),
                    SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <string> >().With(x => x.Property, valueFactory),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        public void WithAnonymousValueReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >(),
                SpecimenBuilderNodeFactory.CreateComposer <int>(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <PropertyHolder <int> >(node);
            // Act
            var actual = sut.With(x => x.Property);
            // Assert
            var expected = new CompositeNodeComposer <PropertyHolder <int> >(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >().With(x => x.Property),
                    SpecimenBuilderNodeFactory.CreateComposer <int>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >().With(x => x.Property),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
 public void WithExplicitValueReturnsCorrectResult(string value)
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<string>>(),
         SpecimenBuilderNodeFactory.CreateComposer<Version>(),
         SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<string>>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<PropertyHolder<string>>(node);
     // Exercise system
     var actual = sut.With(x => x.Property, value);
     // Verify outcome
     var expected = new CompositeNodeComposer<PropertyHolder<string>>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<string>>().With(x => x.Property, value),
             SpecimenBuilderNodeFactory.CreateComposer<Version>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<string>>().With(x => x.Property, value),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }