public void GetCompressionType(string acceptEncodingHeader, string browser, int browserMajorVersion, CompressionType expectedCompressionType)
        {
            Mock<IDateTimeProvider> dateTimeProviderMock = new Mock<IDateTimeProvider>();
            DateTime now = DateTime.Now;
            dateTimeProviderMock.SetupGet(x => x.UtcNow).Returns(now);
            HttpResponseStub httpResponseStub = new HttpResponseStub(new MemoryStream());
            HttpRequestStub httpRequestStub = new HttpRequestStub(new NameValueCollection(), new HttpBrowserCapabilitiesStub(browser, browserMajorVersion));
            httpRequestStub.Headers.Add("Accept-Encoding", acceptEncodingHeader);
            Mock<HttpContextBase> httpContextMock = HttpContextMockHelper.CreateHttpContext(httpResponseStub, httpRequestStub);
            HttpResponseCompressor httpResponseCompressor = new HttpResponseCompressor();

            Assert.AreEqual(expectedCompressionType, httpResponseCompressor.GetRequestCompressionType(httpContextMock.Object));
        }
        public void Compress(string acceptEncodingHeader, string expectedContentEncodingHeader)
        {
            Mock<IDateTimeProvider> dateTimeProviderMock = new Mock<IDateTimeProvider>();
            DateTime now = DateTime.Now;
            dateTimeProviderMock.SetupGet(x => x.UtcNow).Returns(now);
            HttpResponseStub httpResponseStub = new HttpResponseStub(new MemoryStream());
            HttpRequestStub httpRequestStub = new HttpRequestStub();
            httpRequestStub.Headers.Add("Accept-Encoding", acceptEncodingHeader);
            Mock<HttpContextBase> httpContextMock = HttpContextMockHelper.CreateHttpContext(httpResponseStub, httpRequestStub);
            HttpResponseCompressor httpResponseCompressor = new HttpResponseCompressor();
            httpResponseCompressor.Compress(httpContextMock.Object, httpResponseCompressor.GetRequestCompressionType(httpContextMock.Object));

            if (expectedContentEncodingHeader.IsNullOrEmpty())
            {
                Assert.AreEqual(null, httpContextMock.Object.Response.Headers["Content-Encoding"]);
            }
            else
            {
                Assert.IsTrue(httpContextMock.Object.Response.Headers["Content-Encoding"].Contains(expectedContentEncodingHeader));
            }
        }