Esempio n. 1
0
        public OwinResponse post_fake_response(OwinRequest request)
        {
            _writer.WriteResponseCode((HttpStatusCode)Enum.ToObject(typeof(HttpStatusCode), request.StatusCode), request.StatusDescription);

            if (request.Headers != null)
            {
                request.Headers.Each(x => x.Write(_writer));
            }

            return(new OwinResponse
            {
                Description = _response.StatusDescription,
                StatusCode = _response.StatusCode,
                ResponseHeaders = _response.AllHeaders().ToArray()
            });
        }
        public void read_values_from_the_response()
        {
            var request = new OwinRequest
            {
                Headers = new Header[] { new Header("x_a", "1"), new Header("x_b", "2") },
                StatusCode = 201,
                StatusDescription = "Weird"
            };

            var response = endpoints.PostJson(request).ReadAsJson<OwinResponse>();
            response.Description.ShouldEqual(request.StatusDescription);
            response.StatusCode.ShouldEqual(request.StatusCode);

            request.Headers.Each(x =>
            {
                response.ResponseHeaders.ShouldContain(x);
            });
        }
Esempio n. 3
0
        public void read_values_from_the_response()
        {
            var request = new OwinRequest
            {
                Headers           = new Header[] { new Header("x_a", "1"), new Header("x_b", "2") },
                StatusCode        = 201,
                StatusDescription = "Weird"
            };

            var response = endpoints.PostJson(request).ReadAsJson <OwinResponse>();

            response.Description.ShouldEqual(request.StatusDescription);
            response.StatusCode.ShouldEqual(request.StatusCode);

            request.Headers.Each(x =>
            {
                response.ResponseHeaders.ShouldContain(x);
            });
        }
Esempio n. 4
0
        public void read_values_from_the_response()
        {
            var request = new OwinRequest
            {
                Headers           = new[] { new Header("x_a", "1"), new Header("x_b", "2") },
                StatusCode        = 201,
                StatusDescription = "Weird"
            };

            TestHost.Scenario(_ =>
            {
                _.Post.Json(request);

                _.StatusCodeShouldBe(HttpStatusCode.Created);

                var response = _.Response.Body.ReadAsJson <OwinResponse>();
                response.Description.ShouldBe(request.StatusDescription);
                response.StatusCode.ShouldBe(request.StatusCode);

                request.Headers.Each(x => { response.ResponseHeaders.ShouldContain(x); });
            });
        }
        public void read_values_from_the_response()
        {
            var request = new OwinRequest
            {
                Headers = new[] {new Header("x_a", "1"), new Header("x_b", "2")},
                StatusCode = 201,
                StatusDescription = "Weird"
            };

            TestHost.Scenario(_ =>
            {
                _.Post.Json(request);

                _.StatusCodeShouldBe(HttpStatusCode.Created);

                var response = _.Response.Body.ReadAsJson<OwinResponse>();
                response.Description.ShouldBe(request.StatusDescription);
                response.StatusCode.ShouldBe(request.StatusCode);

                request.Headers.Each(x => { response.ResponseHeaders.ShouldContain(x); });
            });
        }
        public OwinResponse post_fake_response(OwinRequest request)
        {
            _writer.WriteResponseCode((HttpStatusCode)Enum.ToObject(typeof(HttpStatusCode), request.StatusCode), request.StatusDescription);

            if (request.Headers != null)
            {
                request.Headers.Each(x => x.Write(_writer));
            }

            return new OwinResponse
            {
                Description = _response.StatusDescription,
                StatusCode = _response.StatusCode,
                ResponseHeaders = _response.AllHeaders().ToArray()
            };
        }