public async void Should_Map_Http_Status_Code(HttpStatusCode code)
        {
            /* Setup */
            _serializers.AddRange(ContentSerializers.Defaults);
            _rawResponse
            .Setup(r => r.StatusCode)
            .Returns(code);

            /* Test */
            var result = await _transformer.TransformAsync <string>(_rawResponse.Object);

            /* Assert */
            Assert.That(result.StatusCode, Is.EqualTo(code));
        }
Ejemplo n.º 2
0
        private async Task <IHttpResponse <T> > PerformRequestAsync <T>(HttpMethod method, string url, object query, ContentType type = ContentType.Negotiated, object data = null) where T : class
        {
            var fullUrl = _urlBuilder.Build(url, query);

            var request = _requestWrapper
                          .WithUrl(fullUrl)
                          .WithMethod(method)
                          .WithPayload(data, type)
                          .Prepare();

            var response = await request.PerformAsync();

            return(await _responseTransformer.TransformAsync <T>(response));
        }
Ejemplo n.º 3
0
        private async Task <IHttpResponse <T> > PerformRequestAsync <T>(HttpMethod method, string url, object query, ContentType type = ContentType.ApplicationJson, object data = null) where T : class
        {
            var response = await GetRawResponseAsync(method, url, query, type, data);

            return(await _responseTransformer.TransformAsync <T>(response));
        }