Exemple #1
0
        public void StopPipeline(TrackedCommand command, BlockingPipelineStage stageA, TrackedPipelineStage stageB)
        {
            "Given I have a command"
            .Given(() =>
            {
                command = new TrackedCommand {
                    A = 1, B = 2
                };
            });

            "And a stage in the pipeline which the command cannot passthrough"
            .And(() =>
            {
                stageA = new BlockingPipelineStage {
                    Next = pipeline.IssueCommand
                };
                pipeline.SetRoot(stageA);
            });

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

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

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

            "Then the command handler should not have been executed"
            .Then(() =>
            {
                TrackedCommandHandler.HasExecuted.Should().BeFalse();
            });

            "And the blocking pipeline stage should have been executed"
            .And(() =>
            {
                stageA.HasExecuted.Should().BeTrue();
            });

            "And each additional pipeline stage should not have been executed"
            .And(() =>
            {
                stageB.HasExecuted.Should().BeFalse();
            });
        }
        public void StopPipeline(TrackedCommand command, BlockingPipelineStage stageA, TrackedPipelineStage stageB)
        {
            "Given I have a command"
                .Given(() =>
                {
                    command = new TrackedCommand { A = 1, B = 2 };
                });

            "And a stage in the pipeline which the command cannot passthrough"
                .And(() =>
                {
                    stageA = new BlockingPipelineStage { Next = pipeline.IssueCommand };
                    pipeline.SetRoot(stageA);
                });

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

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

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

            "Then the command handler should not have been executed"
                .Then(() =>
                {
                    TrackedCommandHandler.HasExecuted.Should().BeFalse();
                });

            "And the blocking pipeline stage should have been executed"
                .And(() =>
                {
                    stageA.HasExecuted.Should().BeTrue();
                });

            "And each additional pipeline stage should not have been executed"
                .And(() =>
                {
                    stageB.HasExecuted.Should().BeFalse();
                });
        }