private IHttpRequestMessageMapper GetSubject()
        {
            _mockHttpMethodMapper      = Substitute.For <IHttpMethodMapper>();
            _mockHttpContentMapper     = Substitute.For <IHttpContentMapper>();
            _mockHttpBodyContentMapper = Substitute.For <IHttpBodyContentMapper>();

            return(new HttpRequestMessageMapper(_mockHttpMethodMapper, _mockHttpContentMapper, _mockHttpBodyContentMapper));
        }
        public IHttpRequestMessageMapper GetSubject()
        {
            _mockHttpMethodMapper = Substitute.For<IHttpMethodMapper>();
            _mockHttpContentMapper = Substitute.For<IHttpContentMapper>();
            _mockHttpBodyContentMapper = Substitute.For<IHttpBodyContentMapper>();

            return new HttpRequestMessageMapper(_mockHttpMethodMapper, _mockHttpContentMapper, _mockHttpBodyContentMapper);
        }
 internal HttpRequestMessageMapper(
     IHttpMethodMapper httpMethodMapper,
     IHttpContentMapper httpContentMapper,
     IHttpBodyContentMapper httpBodyContentMapper)
 {
     _httpMethodMapper = httpMethodMapper;
     _httpContentMapper = httpContentMapper;
     _httpBodyContentMapper = httpBodyContentMapper;
 }
 internal HttpRequestMessageMapper(
     IHttpMethodMapper httpMethodMapper,
     IHttpContentMapper httpContentMapper,
     IHttpBodyContentMapper httpBodyContentMapper)
 {
     _httpMethodMapper      = httpMethodMapper;
     _httpContentMapper     = httpContentMapper;
     _httpBodyContentMapper = httpBodyContentMapper;
 }
Beispiel #5
0
        public void Convert_WithContentTypeContainingParameter_ReturnsContentWithContentTypeHeader()
        {
            const string         contentType      = "text/plain";
            const string         content          = "test";
            NameValueHeaderValue versionParameter = new NameValueHeaderValue("version", "1");

            var httpBodyContent = new HttpBodyContent(
                content: Encoding.UTF8.GetBytes(content),
                contentType: new MediaTypeHeaderValue(contentType)
            {
                CharSet = "utf-8", Parameters = { versionParameter }
            });
            IHttpContentMapper mapper = GetSubject();

            HttpContent result = mapper.Convert(httpBodyContent);

            Assert.Equal(contentType, result.Headers.ContentType.MediaType);
            Assert.Contains(versionParameter, result.Headers.ContentType.Parameters);
            Assert.Equal("utf-8", result.Headers.ContentType.CharSet);
            Assert.Equal(content, result.ReadAsStringAsync().Result);
        }