Esempio n. 1
0
        public void MultiplePipelineStages(TrackedCommand command, TrackedPipelineStage stageA, TrackedPipelineStage stageB)
        {
            "Given I have a command"
            .Given(() =>
            {
                command = new TrackedCommand {
                    A = 1, B = 2
                };
            });

            "And multiple stages in the pipeline which the command can passthrough"
            .And(() =>
            {
                stageA = new TrackedPipelineStage();
                stageB = new TrackedPipelineStage();

                stageA.Next = stageB;
                stageB.Next = pipeline.IssueCommand;

                pipeline.SetRoot(stageA);
            });

            "When the command is processed in the pipeline"
            .When(async() =>
            {
                await pipeline.Execute(command);
            });

            "Then the command handler should have been executed"
            .Then(() =>
            {
                TrackedCommandHandler.LastCommand.Should().BeSameAs(command);
            });

            "And each additional pipeline stage should have been executed"
            .And(() =>
            {
                stageA.LastCommand.Should().BeSameAs(command);
                stageB.LastCommand.Should().BeSameAs(command);
            });
        }
Esempio n. 2
0
        protected CommandPipeline CreateCommandPipeline()
        {
            var commandPipeline = new CommandPipeline(new ExclusiveHandlerCommandBus(handlerFactory));

            if (configurePipeline != null)
            {
                var pipelineRoot = configurePipeline(commandPipeline);
                commandPipeline.SetRoot(pipelineRoot);
            }

            commandPipeline.IssueCommand.Next = postProcessPipelineStage;
            return(commandPipeline);
        }
Esempio n. 3
0
        protected CommandPipeline CreateCommandPipeline()
        {
            var commandPipeline = new CommandPipeline(new ExclusiveHandlerCommandBus(handlerFactory));

            if (configurePipeline != null)
            {
                var pipelineRoot = configurePipeline(commandPipeline);
                commandPipeline.SetRoot(pipelineRoot);
            }

            commandPipeline.IssueCommand.Next = postProcessPipelineStage;
            return commandPipeline;
        }