public void Should_read_entire_request_body_when_there_is_a_continuation() { var requestBody = Encoding.ASCII.GetBytes("This is some request body content"); var fakeRequestBodyDelegate = new FakeProducer(true, requestBody, 5, false); this.environment["owin.RequestBody"] = (BodyDelegate)fakeRequestBodyDelegate; Request request = null; A.CallTo(() => this.fakeEngine.HandleRequest(A <Request> .Ignored, A <Action <NancyContext> > .Ignored, A <Action <Exception> > .Ignored)) .Invokes(i => request = (Request)i.Arguments[0]); this.host.ProcessRequest(environment, fakeResponseCallback, fakeErrorCallback); fakeRequestBodyDelegate.SendAll(); var read = new StreamReader(request.Body); var output = read.ReadToEnd(); output.ShouldEqual("This is some request body content"); }
public void Should_read_entire_request_body_when_there_is_a_continuation() { var requestBody = Encoding.ASCII.GetBytes("This is some request body content"); var fakeRequestBodyDelegate = new FakeProducer(true, requestBody, 5, false); this.environment["owin.RequestBody"] = (BodyDelegate)fakeRequestBodyDelegate; Request request = null; A.CallTo(() => this.fakeEngine.HandleRequest(A<Request>.Ignored, A<Action<NancyContext>>.Ignored, A<Action<Exception>>.Ignored)) .Invokes(i => request = (Request)i.Arguments[0]); this.host.ProcessRequest(environment, fakeResponseCallback, fakeErrorCallback); fakeRequestBodyDelegate.SendAll(); var read = new StreamReader(request.Body); var output = read.ReadToEnd(); output.ShouldEqual("This is some request body content"); }