public void Client_DeflateCompressHttpContent_Server_DeflateHandlerDecompress()
        {
            var url  = "api/test/Decompression";
            var data = CreateData();

            var content = new CompressContent(new StringContent(data, Encoding.UTF8, "text/plain"),
                                              CompressMethod.Deflate);

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = content
            };
            var response = MsTestHook.Client.SendAsync(request).Result;
            var result   = response.Content.ReadAsStringAsync().Result;

            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            Assert.AreEqual(data, result);
        }
Beispiel #2
0
        public void Post()
        {
            var url  = "api/JsonData/Post";
            var data = GetDataFromFile();

            var content = new CompressContent(new ObjectContent <IEnumerable <Member> >(data,
                                                                                        new JsonMediaTypeFormatter(),
                                                                                        MimeType.Application.Json
                                                                                        ),
                                              CompressMethod.Deflate);

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = content
            };
            var response = MsTestHook.Client.SendAsync(request).Result;

            Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
        }