Inheritance: IResponseDecoder
Exemplo n.º 1
0
        public void DecodeResponse_with_utf8_default_should_return_expected_response()
        {
            _webClient.Encoding = Encoding.UTF8;
            var expectedResponse = InternationalCurrencySymbols;
            var responseBytes = Encoding.UTF8.GetBytes(expectedResponse);

            var decoder = new ResponseDecoder();
            var response = decoder.DecodeResponse(_webClient, responseBytes);

            Assert.That(response, Is.EqualTo(expectedResponse));
        }
Exemplo n.º 2
0
        public void DecodeResponse_ascii_should_return_expected_response()
        {
            _webClient.Encoding = Encoding.ASCII;
            var expectedResponse = "response";
            var responseBytes = Encoding.ASCII.GetBytes(expectedResponse);

            var decoder = new ResponseDecoder();
            var response = decoder.DecodeResponse(_webClient, responseBytes);

            Assert.That(response, Is.EqualTo(expectedResponse));
        }
Exemplo n.º 3
0
        public void DecodeResponse_with_utf8_response_header_should_return_expected_response()
        {
            _webClient.Encoding = Encoding.ASCII;
            _webClient.ResponseHeaders.Add(HttpResponseHeader.ContentType, "text/html; charset=UTF-8");
            var expectedResponse = InternationalCurrencySymbols;
            var responseBytes = Encoding.UTF8.GetBytes(expectedResponse);

            var decoder = new ResponseDecoder();
            var response = decoder.DecodeResponse(_webClient, responseBytes);

            Assert.That(response, Is.EqualTo(expectedResponse));
        }