コード例 #1
0
        public void Should_support_overloading_downstream_with_dispatch_either_way()
        {
            var count = 0;
            IPipe <CommandContext> pipe = Pipe.New <CommandContext>(x =>
            {
                x.UseRetry(r => r.Interval(4, TimeSpan.FromMilliseconds(2)));
                x.UseDispatch(new PipeContextConverterFactory(), d =>
                {
                    d.Pipe <CommandContext <SetConcurrencyLimit> >(p =>
                    {
                        p.UseRetry(r => r.None());
                        p.UseExecute(payload =>
                        {
                            count++;
                            throw new IntentionalTestException("Kaboom!");
                        });
                    });
                });
            });

            Assert.That(async() => await pipe.SetConcurrencyLimit(32), Throws.TypeOf <IntentionalTestException>());

            Assert.That(count, Is.EqualTo(1));
        }
コード例 #2
0
        public void Should_support_overloading_downstream_with_dispatch_either_that_thang()
        {
            var count = 0;
            IPipe <CommandContext> pipe = Pipe.New <CommandContext>(x =>
            {
                x.UseRetry(r => r.SetRetryPolicy(filter => new CommandContextRetryPolicy(new IntervalRetryPolicy(filter, 4, 4, 4, 4))));
                x.UseRetry(r => r.SetRetryPolicy(filter => new CommandContextRetryPolicy(new NoRetryPolicy(filter))));
                x.UseDispatch(new PipeContextConverterFactory(), d =>
                {
                    d.Pipe <CommandContext <SetConcurrencyLimit> >(p =>
                    {
                        p.UseExecute(payload =>
                        {
                            count++;
                            throw new IntentionalTestException("Kaboom!");
                        });
                    });
                });
            });

            Assert.That(async() => await pipe.SetConcurrencyLimit(32), Throws.TypeOf <IntentionalTestException>());

            Assert.That(count, Is.EqualTo(1));
        }
コード例 #3
0
 public async Task DispatchPipe()
 {
     await _dispatchPipe.SetConcurrencyLimit(32);
 }