public async void Pipeline_Mechanism_Produces_A_Simple_Check_Before_Returning_A_Result()
        {
            PipelineRunner runner = new PipelineRunner();

            var arguments = new HelloWorldArguments {
                Name = "   "
            };
            await runner.RunPipeline(new HelloWorldPipelineWithValidation(), arguments);

            arguments.GetMessages(MessageFilter.Errors).Should().ContainSingle(pipelineMessage =>
                                                                               pipelineMessage.Message.Equals(HelloWorldPipelineMessages.NameMustBeProvided));
        }
        public async void Pipeline_Mechanism_Is_Able_To_Produce_A_Simple_Result()
        {
            PipelineRunner runner = new PipelineRunner();

            var arguments = new HelloWorldArguments()
            {
                Name = "Sergey"
            };
            await runner.RunPipeline(new HelloWorldPipeline(), arguments);

            arguments.Result.Should().Be("Hello, Sergey!",
                                         $"we've passed name '{arguments.Name}' to the pipeline, and expect it to be displayed in phrase 'Hello, {arguments.Name}!'");
        }
 public override Task SafeExecute(HelloWorldArguments args)
 {
     args.Result = "Hello, " + args.Name + "!";
     return(Task.CompletedTask);
 }
 public override bool SafeCondition(HelloWorldArguments args)
 {
     return(base.SafeCondition(args) && string.IsNullOrWhiteSpace(args.Name));
 }
 public override Task SafeExecute(HelloWorldArguments args)
 {
     args.AbortPipelineWithErrorMessage(HelloWorldPipelineMessages.NameMustBeProvided);
     return(Task.CompletedTask);
 }