Пример #1
0
        public void ExceptionInStage(TrackedCommand command, Exception exception)
        {
            "Given I have a command"
                .Given(() =>
                {
                    command = new TrackedCommand { A = 1, B = 2 };
                });

            "And a pipeline stage which causes an exception"
                .And(() =>
                {
                    var stageA = new ExceptionPipelineStage {Next = pipeline.IssueCommand};
                    pipeline.SetRoot(stageA);
                });

            "When the command is processed in the pipeline"
                .When(async () =>
                {
                    try
                    {
                        await pipeline.Execute(command);
                    }
                    catch (Exception ex)
                    {
                        exception = ex;
                    }
                });

            "Then the exception is not captured"
                .Then(() =>
                {
                    exception.Should().NotBeNull();
                });
        }
Пример #2
0
        public void ExceptionInStage(TrackedCommand command, Exception exception)
        {
            "Given I have a command"
            .Given(() =>
            {
                command = new TrackedCommand {
                    A = 1, B = 2
                };
            });

            "And a pipeline stage which causes an exception"
            .And(() =>
            {
                var stageA = new ExceptionPipelineStage {
                    Next = pipeline.IssueCommand
                };
                pipeline.SetRoot(stageA);
            });

            "When the command is processed in the pipeline"
            .When(async() =>
            {
                try
                {
                    await pipeline.Execute(command);
                }
                catch (Exception ex)
                {
                    exception = ex;
                }
            });

            "Then the exception is not captured"
            .Then(() =>
            {
                exception.Should().NotBeNull();
            });
        }