示例#1
0
        public async Task ExecuteAsync_FullPipeline_ExecutesToTheEnd()
        {
            var initialComponent = PipelineComponent.CreateAsyncPipeline <string, int>((x, c) => Task.FromResult(x.Length));

            IPipelineOutput <bool> pipelineOutput = initialComponent
                                                    .AddStep((x, c) => Task.FromResult(x > 10));

            await initialComponent.ExecuteAsync("dit is een test string");

            Assert.IsTrue(pipelineOutput.GetOutput());
        }
示例#2
0
        public async Task ExecuteAsync_BrokenPipeline_DoesNotFinish()
        {
            bool triggered        = false;
            var  initialComponent = PipelineComponent.CreateAsyncPipeline <int, bool>((x, c) =>
            {
                c.Break();
                return(Task.FromResult(true));
            });

            IPipelineOutput <bool> pipelineOutput = initialComponent.AddStep((x, c) =>
            {
                triggered = true;
                return(Task.FromResult(x));
            });

            var context = new PipelineContext();

            await initialComponent.ExecuteAsync(10, context);

            Assert.IsTrue(context.IsBroken);
            Assert.IsFalse(triggered);
        }
示例#3
0
 public static IAsyncPipelineComponent <POut, NOut> AddStep <PIn, POut, NOut>(this IAsyncPipelineComponent <PIn, POut> component, Func <POut, IPipelineContext, Task <NOut> > step)
 {
     return(component.AddStep(PipelineComponent.CreateAsyncPipeline(step)));
 }
示例#4
0
 public static IAsyncPipelineComponent <POut, NOut> AddStep <PIn, POut, NOut>(this IAsyncPipelineComponent <PIn, POut> component, IAsyncPipelineStep <POut, NOut> step)
 {
     return(component.AddStep(PipelineComponent.CreateAsyncPipeline(step)));
 }