Exemplo n.º 1
0
        /// <summary>Accepteds the headers.</summary>
        /// <returns></returns>
        public async Task <IApiResponse> Accepted_Headers()
        {
            await Awaiter();

            var response = ApiResponse.Accepted(location: "/test/location", headers: new List <ApiHeader>
            {
                new ApiHeader("Test", "Value")
            });

            return(response);
        }
Exemplo n.º 2
0
        public void Accepted_SetsProperApiResponse(string id, string httpBody)
        {
            Body body     = httpBody == null ? null : Body.FromString(httpBody);
            var  location = new Uri($"http://localhost:801/data/{id}");

            var response = ApiResponse.Accepted(location, body);

            response.ShouldSatisfyAllConditions(
                () => response.StatusCode.ShouldBe(202),
                () => response.ReasonPhrase.ShouldBeNull(),
                () => response.Headers["Location"].ShouldBe(location.AbsoluteUri),
                () => response.Headers.Count.ShouldBe(1),
                () => response.Body.ShouldBeSameAs(body)
                );
        }
Exemplo n.º 3
0
        public void Accepted_SetsProperApiResponse(string id)
        {
            var body     = new { Blob = id };
            Uri location = new Uri($"http://blobs.azure.com/blobs/{id}").MakeRelativeUri(new Uri($"http://blobs.azure.com/"));

            var expectedLocation = location.GetComponents(UriComponents.SerializationInfoString,
                                                          UriFormat.UriEscaped);

            var response = ApiResponse.Accepted(location, body);

            response.ShouldSatisfyAllConditions(
                () => response.StatusCode.ShouldBe(202),
                () => response.ReasonPhrase.ShouldBeNull(),
                () => response.Headers["Location"].ShouldBe(expectedLocation),
                () => response.Headers.Count.ShouldBe(1),
                () => response.Body.Content.ShouldBeSameAs(body)
                );
        }
Exemplo n.º 4
0
 public Task <IApiResponse> PostBasicObjectModelReturnTaskWith202Attribute([InBody] BasicObject request)
 {
     return(Task.FromResult(ApiResponse.Accepted()));
 }
Exemplo n.º 5
0
        /// <summary>Accepteds the null.</summary>
        /// <returns></returns>
        public Task <IApiResponse> Accepted_Null()
        {
            var response = ApiResponse.Accepted(location: "/test/location");

            return(Task.FromResult(response));
        }
Exemplo n.º 6
0
        // Accepted Responses
        // ------------

        /// <summary>Accepteds this instance.</summary>
        /// <returns></returns>
        public IApiResponse Accepted()
        {
            var response = ApiResponse.Accepted(value: new HelperResponseModel());

            return(response);
        }