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); }); }
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); }
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; }