public void FromSpecimenBuilderFactoryReturnsCorrectResult()
        {
            // Fixture setup
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <decimal>(),
                SpecimenBuilderNodeFactory.CreateComposer <int>(),
                SpecimenBuilderNodeFactory.CreateComposer <decimal>(),
                new DelegatingSpecimenBuilder());
            var sut     = new CompositeNodeComposer <decimal>(node);
            var factory = new DelegatingSpecimenBuilder();
            // Exercise system
            var actual = sut.FromFactory(factory);
            // Verify outcome
            var expected = new CompositeNodeComposer <decimal>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <decimal>().FromFactory(factory),
                    SpecimenBuilderNodeFactory.CreateComposer <int>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <decimal>().FromFactory(factory),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
            // Teardown
        }
        public void FromNoArgFuncReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <Guid>(),
                SpecimenBuilderNodeFactory.CreateComposer <float>(),
                SpecimenBuilderNodeFactory.CreateComposer <Guid>(),
                new DelegatingSpecimenBuilder());
            var         sut = new CompositeNodeComposer <Guid>(node);
            Func <Guid> f   = () => Guid.Empty;
            // Act
            var actual = sut.FromFactory(f);
            // Assert
            var expected = new CompositeNodeComposer <Guid>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Guid>().FromFactory(f),
                    SpecimenBuilderNodeFactory.CreateComposer <float>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Guid>().FromFactory(f),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        public void FromTripleArgFuncReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <long>(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <long>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <long>(node);
            Func <long, int, short, long> f = (x, y, z) => x;
            // Act
            var actual = sut.FromFactory(f);
            // Assert
            var expected = new CompositeNodeComposer <long>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <long>().FromFactory(f),
                    SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <long>().FromFactory(f),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        public void FromSingleArgFuncReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <string>(),
                SpecimenBuilderNodeFactory.CreateComposer <ulong>(),
                SpecimenBuilderNodeFactory.CreateComposer <string>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <string>(node);
            Func <int, string> f = i => i.ToString();
            // Act
            var actual = sut.FromFactory(f);
            // Assert
            var expected = new CompositeNodeComposer <string>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <string>().FromFactory(f),
                    SpecimenBuilderNodeFactory.CreateComposer <ulong>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <string>().FromFactory(f),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        public void DoReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <ConcreteType>(),
                SpecimenBuilderNodeFactory.CreateComposer <bool>(),
                SpecimenBuilderNodeFactory.CreateComposer <ConcreteType>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <ConcreteType>(node);
            Action <ConcreteType> a =
                ads => ads.Property1 = null;
            // Act
            var actual = sut.Do(a);
            // Assert
            var expected = new CompositeNodeComposer <ConcreteType>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <ConcreteType>().Do(a),
                    SpecimenBuilderNodeFactory.CreateComposer <bool>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <ConcreteType>().Do(a),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        public void FromQuadrupleArgFuncReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <Guid>(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <Version>(node);
            Func <int, int, int, int, Version> f =
                (mj, mn, b, r) => new Version(mj, mn, b, r);
            // Act
            var actual = sut.FromFactory(f);
            // Assert
            var expected = new CompositeNodeComposer <Version>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().FromFactory(f),
                    SpecimenBuilderNodeFactory.CreateComposer <Guid>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().FromFactory(f),
                    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
        }
        public void WithoutReturnsCorrectResult()
        {
            // Fixture setup
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <FieldHolder <short> >(),
                SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >(),
                SpecimenBuilderNodeFactory.CreateComposer <FieldHolder <short> >(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <FieldHolder <short> >(node);
            // Exercise system
            var actual = sut.Without(x => x.Field);
            // Verify outcome
            var expected = new CompositeNodeComposer <FieldHolder <short> >(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <FieldHolder <short> >().Without(x => x.Field),
                    SpecimenBuilderNodeFactory.CreateComposer <PropertyHolder <int> >(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <FieldHolder <short> >().Without(x => x.Field),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

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

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
            // Teardown
        }
        public void DoReturnsCorrectResult()
        {
            // Fixture setup
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <AppDomainSetup>(),
                SpecimenBuilderNodeFactory.CreateComposer <bool>(),
                SpecimenBuilderNodeFactory.CreateComposer <AppDomainSetup>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <AppDomainSetup>(node);
            Action <AppDomainSetup> a =
                ads => ads.DisallowApplicationBaseProbing = false;
            // Exercise system
            var actual = sut.Do(a);
            // Verify outcome
            var expected = new CompositeNodeComposer <AppDomainSetup>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <AppDomainSetup>().Do(a),
                    SpecimenBuilderNodeFactory.CreateComposer <bool>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <AppDomainSetup>().Do(a),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
            // Teardown
        }
        public void FromDoubleArgFuncReturnsCorrectResult()
        {
            // Fixture setup
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <string>(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <Version>(node);
            Func <int, int, Version> f = (mj, mn) => new Version(mj, mn);
            // Exercise system
            var actual = sut.FromFactory(f);
            // Verify outcome
            var expected = new CompositeNodeComposer <Version>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().FromFactory(f),
                    SpecimenBuilderNodeFactory.CreateComposer <string>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().FromFactory(f),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
            // Teardown
        }
        public void FromSpecimenBuilderFactoryReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <decimal>(),
                SpecimenBuilderNodeFactory.CreateComposer <int>(),
                SpecimenBuilderNodeFactory.CreateComposer <decimal>(),
                new DelegatingSpecimenBuilder());
            var sut     = new CompositeNodeComposer <decimal>(node);
            var factory = new DelegatingSpecimenBuilder();
            // Act
            var actual = sut.FromFactory(factory);
            // Assert
            var expected = new CompositeNodeComposer <decimal>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <decimal>().FromFactory(factory),
                    SpecimenBuilderNodeFactory.CreateComposer <int>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <decimal>().FromFactory(factory),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
        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 OmitAutoPropertiesReturnsCorrectResult()
        {
            // Arrange
            var node = new CompositeSpecimenBuilder(
                new DelegatingSpecimenBuilder(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                SpecimenBuilderNodeFactory.CreateComposer <UTF8Encoding>(),
                SpecimenBuilderNodeFactory.CreateComposer <Version>(),
                new DelegatingSpecimenBuilder());
            var sut = new CompositeNodeComposer <Version>(node);
            // Act
            var actual = sut.OmitAutoProperties();
            // Assert
            var expected = new CompositeNodeComposer <Version>(
                new CompositeSpecimenBuilder(
                    new DelegatingSpecimenBuilder(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().OmitAutoProperties(),
                    SpecimenBuilderNodeFactory.CreateComposer <UTF8Encoding>(),
                    (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer <Version>().OmitAutoProperties(),
                    new DelegatingSpecimenBuilder()));
            var n = Assert.IsAssignableFrom <ISpecimenBuilderNode>(actual);

            Assert.True(expected.GraphEquals(n, new NodeComparer()));
        }
 public void OmitAutoPropertiesAfterAddingAutoPropertiesReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<Version>(),
         SpecimenBuilderNodeFactory.CreateComposer<string>(),
         SpecimenBuilderNodeFactory.CreateComposer<Version>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<Version>(node);
     // Exercise system
     var actual = sut.WithAutoProperties().OmitAutoProperties();
     // Verify outcome
     var expected = new CompositeNodeComposer<Version>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<Version>().WithAutoProperties().OmitAutoProperties(),
             SpecimenBuilderNodeFactory.CreateComposer<string>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<Version>().WithAutoProperties().OmitAutoProperties(),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }
 public void FromSpecimenBuilderFactoryReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<decimal>(),
         SpecimenBuilderNodeFactory.CreateComposer<int>(),
         SpecimenBuilderNodeFactory.CreateComposer<decimal>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<decimal>(node);
     var factory = new DelegatingSpecimenBuilder();
     // Exercise system
     var actual = sut.FromFactory(factory);
     // Verify outcome
     var expected = new CompositeNodeComposer<decimal>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<decimal>().FromFactory(factory),
             SpecimenBuilderNodeFactory.CreateComposer<int>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<decimal>().FromFactory(factory),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }
 public void FromSingleArgFuncReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<string>(),
         SpecimenBuilderNodeFactory.CreateComposer<ulong>(),
         SpecimenBuilderNodeFactory.CreateComposer<string>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<string>(node);
     Func<int, string> f = i => i.ToString();
     // Exercise system
     var actual = sut.FromFactory(f);
     // Verify outcome
     var expected = new CompositeNodeComposer<string>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<string>().FromFactory(f),
             SpecimenBuilderNodeFactory.CreateComposer<ulong>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<string>().FromFactory(f),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }
 public void FromQuadrupleArgFuncReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<Version>(),
         SpecimenBuilderNodeFactory.CreateComposer<Guid>(),
         SpecimenBuilderNodeFactory.CreateComposer<Version>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<Version>(node);
     Func<int, int, int , int, Version> f = 
         (mj, mn, b, r) => new Version(mj, mn, b, r);
     // Exercise system
     var actual = sut.FromFactory(f);
     // Verify outcome
     var expected = new CompositeNodeComposer<Version>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<Version>().FromFactory(f),
             SpecimenBuilderNodeFactory.CreateComposer<Guid>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<Version>().FromFactory(f),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }
 public void DoReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<AppDomainSetup>(),
         SpecimenBuilderNodeFactory.CreateComposer<bool>(),
         SpecimenBuilderNodeFactory.CreateComposer<AppDomainSetup>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<AppDomainSetup>(node);
     Action<AppDomainSetup> a =
         ads => ads.DisallowApplicationBaseProbing = false;
     // Exercise system
     var actual = sut.Do(a);
     // Verify outcome
     var expected = new CompositeNodeComposer<AppDomainSetup>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<AppDomainSetup>().Do(a),
             SpecimenBuilderNodeFactory.CreateComposer<bool>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<AppDomainSetup>().Do(a),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }
 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 WithoutReturnsCorrectResult()
 {
     // Fixture setup
     var node = new CompositeSpecimenBuilder(
         new DelegatingSpecimenBuilder(),
         SpecimenBuilderNodeFactory.CreateComposer<FieldHolder<short>>(),
         SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<int>>(),
         SpecimenBuilderNodeFactory.CreateComposer<FieldHolder<short>>(),
         new DelegatingSpecimenBuilder());
     var sut = new CompositeNodeComposer<FieldHolder<short>>(node);
     // Exercise system
     var actual = sut.Without(x => x.Field);
     // Verify outcome
     var expected = new CompositeNodeComposer<FieldHolder<short>>(
         new CompositeSpecimenBuilder(
             new DelegatingSpecimenBuilder(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<FieldHolder<short>>().Without(x => x.Field),
             SpecimenBuilderNodeFactory.CreateComposer<PropertyHolder<int>>(),
             (ISpecimenBuilder)SpecimenBuilderNodeFactory.CreateComposer<FieldHolder<short>>().Without(x => x.Field),
             new DelegatingSpecimenBuilder()));
     var n = Assert.IsAssignableFrom<ISpecimenBuilderNode>(actual);
     Assert.True(expected.GraphEquals(n, new NodeComparer()));
     // Teardown
 }