public void SutIsSpecimenBuilder()
 {
     // Fixture setup
     var dummySpecimen = new object();
     // Exercise system
     var sut = new FixedBuilder(dummySpecimen);
     // Verify outcome
     Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
     // Teardown
 }
 public void CreateReturnsCorrectResult()
 {
     // Fixture setup
     var expectedSpecimen = new object();
     var sut = new FixedBuilder(expectedSpecimen);
     // Exercise system
     var dummyRequest = new object();
     var dummyContext = new DelegatingSpecimenContext();
     var result = sut.Create(dummyRequest, dummyContext);
     // Verify outcome
     Assert.Equal(expectedSpecimen, result);
     // Teardown
 }
        /// <summary>
        /// Customizes the fixture by freezing the value of <see cref="TargetType"/>.
        /// </summary>
        /// <param name="fixture">The fixture to customize.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="fixture"/> is null.
        /// </exception>
        public void Customize(IFixture fixture)
        {
            if (fixture == null)
            {
                throw new ArgumentNullException(nameof(fixture));
            }

            var specimen = fixture.Create(
                    this.targetType);
            var fixedBuilder = new FixedBuilder(specimen);

            var types = new[]
                {
                    this.targetType,
                    this.registeredType 
                };

            var builder = new CompositeSpecimenBuilder(
                from t in types
                select SpecimenBuilderNodeFactory.CreateTypedNode(
                    t, fixedBuilder) as ISpecimenBuilder);

            fixture.Customizations.Insert(0, builder);
        }
        /// <summary>
        /// Customizes the fixture by freezing the value of <see cref="TargetType"/>.
        /// </summary>
        /// <param name="fixture">The fixture to customize.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="fixture"/> is null.
        /// </exception>
        public void Customize(IFixture fixture)
        {
            if (fixture == null)
            {
                throw new ArgumentNullException("fixture");
            }

            var specimen = fixture.CreateAnonymous(
                    this.targetType);
            var fixedBuilder = new FixedBuilder(specimen);

            var types = new[]
                {
                    this.targetType,
                    this.registeredType 
                };

            var builder = new CompositeSpecimenBuilder(
                from t in types
                select new TypedBuilderComposer(
                    t, fixedBuilder).Compose());

            fixture.Customizations.Insert(0, builder);
        }