public void Can_optimize_result_with_ToOptimizedResult() { var dto = new TestDto { Name = "test" }; var httpReq = new MockHttpRequest(); httpReq.Headers.Add(HttpHeaders.AcceptEncoding, "gzip,deflate,sdch"); httpReq.ResponseContentType = "text/html"; var httpRes = new ViewTests.MockHttpResponse(); var httpRequestContext = new HttpRequestContext(httpReq, httpRes, dto); var appHost = new TestAppHost(); new HtmlFormat().Register(appHost); EndpointHost.ContentTypeFilter = appHost.ContentTypeFilters; object result = httpRequestContext.ToOptimizedResult(dto); Assert.IsNotNull(result); Assert.IsTrue(result is CompressedResult); }
private static void CanOptimizeResult(string contentType, IPlugin pluginFormat) { var dto = new TestDto { Name = "test" }; var httpReq = new MockHttpRequest(); httpReq.Headers.Add(HttpHeaders.AcceptEncoding, "gzip,deflate,sdch"); httpReq.ResponseContentType = contentType; var httpRes = new ViewTests.MockHttpResponse(); var httpRequestContext = new HttpRequestContext(httpReq, httpRes, dto); var appHost = new TestAppHost(); if (pluginFormat != null) { pluginFormat.Register(appHost); } EndpointHost.ContentTypeFilter = appHost.ContentTypeFilters; object result = httpRequestContext.ToOptimizedResult(dto); Assert.IsNotNull(result); Assert.IsTrue(result is CompressedResult); }
private static void CanOptimizeResult(string contentType, IPlugin pluginFormat) { var dto = new TestDto {Name = "test"}; var httpReq = new MockHttpRequest(); httpReq.Headers.Add(HttpHeaders.AcceptEncoding, "gzip,deflate,sdch"); httpReq.ResponseContentType = contentType; var httpRes = new ViewTests.MockHttpResponse(); var httpRequestContext = new HttpRequestContext(httpReq, httpRes, dto); var appHost = new TestAppHost(); if (pluginFormat != null) pluginFormat.Register(appHost); EndpointHost.ContentTypeFilter = appHost.ContentTypeFilters; object result = httpRequestContext.ToOptimizedResult(dto); Assert.IsNotNull(result); Assert.IsTrue(result is CompressedResult); }