public async Task middleware_continues()
        {
            var middleware = new PreExecuteMiddleware(
                Contributor(e => Task.FromResult(PipelineContinuation.RenderNow)))
                             .Compose(Next);
            await middleware.Invoke(Env);

            ContributorCalled.ShouldBeTrue();
            NextCalled.ShouldBeTrue();
            Env.PipelineData.PipelineStage.CurrentState.ShouldBe(PipelineContinuation.RenderNow);
        }
Beispiel #2
0
        public void middleware_throws()
        {
            var middleware = new PreExecuteMiddleware(Contributor(e => Task.FromResult(PipelineContinuation.Abort)))
                             .Compose(Next);

            middleware.Invoke(Env).ShouldThrow <PipelineAbortedException>();

            ContributorCalled.ShouldBeTrue();
            NextCalled.ShouldBeFalse();

#pragma warning disable 618
            Env.PipelineData.PipelineStage.CurrentState.ShouldBe(PipelineContinuation.Abort);
#pragma warning restore 618
        }