Inheritance: IHttpHandler
Exemple #1
0
        public async Task ProcessRequest_StopsExecutingWhenTerminateReturned()
        {
            var context       = Substitute.For <IStumpsHttpContext>();
            var pipe          = new HttpPipelineHandler();
            var innerHandler1 = new NoOpHandler(ProcessHandlerResult.Terminate);
            var innerHandler2 = new NoOpHandler(ProcessHandlerResult.Continue);

            pipe.Add(innerHandler1);
            pipe.Add(innerHandler2);

            var result = await pipe.ProcessRequest(context);

            Assert.AreEqual(ProcessHandlerResult.Terminate, result, "The process request returned a Continue.");
            Assert.AreEqual(1, innerHandler1.ProcessRequestCalls());
            Assert.AreEqual(0, innerHandler2.ProcessRequestCalls());
        }
        public async void ProcessRequest_StopsExecutingWhenTerminateReturned()
        {

            var context = Substitute.For<IStumpsHttpContext>();
            var pipe = new HttpPipelineHandler();
            var innerHandler1 = new NoOpHandler(ProcessHandlerResult.Terminate);
            var innerHandler2 = new NoOpHandler(ProcessHandlerResult.Continue);

            pipe.Add(innerHandler1);
            pipe.Add(innerHandler2);

            var result = await pipe.ProcessRequest(context);

            Assert.AreEqual(ProcessHandlerResult.Terminate, result, "The process request returned a Continue.");
            Assert.AreEqual(1, innerHandler1.ProcessRequestCalls());
            Assert.AreEqual(0, innerHandler2.ProcessRequestCalls());

        }