Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Postprocessor" />
 /// class.
 /// </summary>
 /// <param name="builder">
 /// The <see cref="ISpecimenBuilder"/> to decorate.
 /// </param>
 /// <param name="command">
 /// The command to apply to the created specimen.
 /// </param>
 /// A specification which is used to determine whether postprocessing
 /// should be performed
 /// <param name="specification">
 /// </param>
 public Postprocessor(
     ISpecimenBuilder builder,
     ISpecimenCommand command,
     IRequestSpecification specification)
     : base(builder, command, specification)
 {
 }
Пример #2
0
        public void CommandIsCorrect()
        {
            // Arrange
            var dummyBuilder = new DelegatingSpecimenBuilder();
            var expected     = new DelegatingSpecimenCommand();

            var sut = new Postprocessor <object>(dummyBuilder, expected);
            // Act
            ISpecimenCommand actual = sut.Command;

            // Assert
            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void CommandIsCorrect()
        {
            // Fixture setup
            var dummyBuilder = new DelegatingSpecimenBuilder();
            var expected     = new DelegatingSpecimenCommand();

            var sut = new Postprocessor <object>(dummyBuilder, expected);
            // Exercise system
            ISpecimenCommand actual = sut.Command;

            // Verify outcome
            Assert.Equal(expected, actual);
            // Teardown
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Postprocessor" />
 /// class.
 /// </summary>
 /// <param name="builder">
 /// The <see cref="ISpecimenBuilder"/> to decorate.
 /// </param>
 /// <param name="command">
 /// The command to apply to the created specimen.
 /// </param>
 public Postprocessor(ISpecimenBuilder builder, ISpecimenCommand command)
     : base(builder, command)
 {
 }
Пример #5
0
 public PostprocessorBehavior(ISpecimenCommand command, IRequestSpecification specification)
 {
     _command       = command ?? throw new ArgumentNullException(nameof(command));
     _specification = specification ?? throw new ArgumentNullException(nameof(specification));
 }
Пример #6
0
        private IPostprocessComposer <T> WithCommand <TProperty>(Expression <Func <T, TProperty> > propertyPicker, ISpecimenCommand command)
        {
            ExpressionReflector.VerifyIsNonNestedWritableMemberExpression(propertyPicker);

            var graphWithAutoPropertiesNode   = this.GetGraphWithAutoPropertiesNode();
            var graphWithoutSeedIgnoringRelay = WithoutSeedIgnoringRelay(graphWithAutoPropertiesNode);

            var container = FindContainer(graphWithoutSeedIgnoringRelay);

            var graphWithProperty = graphWithoutSeedIgnoringRelay.ReplaceNodes(
                with: n => n.Compose(
                    new ISpecimenBuilder[]
            {
                new Postprocessor(
                    CompositeSpecimenBuilder.ComposeIfMultiple(n),
                    command,
                    CreateSpecification()),
                new SeedIgnoringRelay()
            }),
                when: container.Equals);

            var member = propertyPicker.GetWritableMember().Member;

            return((NodeComposer <T>)ExcludeMemberFromAutoProperties(member, graphWithProperty));
        }