public void Must_not_allow_client_caching(int statusCode) { _response.Stub(arg => arg.StatusCode).Return(new StatusAndSubStatusCode(statusCode)); _handler.HandleResponseAsync(_httpContext, _response, null, null); _httpCachePolicyBase.AssertWasCalled(arg => arg.SetCacheability(HttpCacheability.NoCache)); }
public void Must_set_response_properties_and_apply_cache_policy() { _httpResponseBase.AssertWasCalled(arg => arg.StatusCode = 200); _httpResponseBase.AssertWasCalled(arg => arg.SubStatusCode = 0); _httpResponseBase.AssertWasCalled(arg => arg.ContentType = "application/json"); _httpResponseBase.AssertWasCalled(arg => arg.Charset = "utf-8"); _httpResponseBase.AssertWasCalled(arg => arg.ContentEncoding = Encoding.ASCII); _httpResponseBase.AssertWasCalled(arg => arg.HeaderEncoding = Encoding.UTF8); Assert.That(_httpResponseBase.Cookies, Has.Count.EqualTo(1)); Assert.That(_httpResponseBase.Headers, Has.Count.EqualTo(1)); _httpResponseBase.AssertWasCalled(arg => arg.BinaryWrite(Encoding.ASCII.GetBytes("content"))); _httpCachePolicyBase.AssertWasCalled(arg => arg.SetCacheability(HttpCacheability.NoCache)); }
public void Must_apply_no_client_and_server_cacheability() { _cachePolicy.NoClientCaching(); _cachePolicy.ServerCaching(DateTime.UtcNow); _cachePolicy.Apply(_httpCachePolicyBase); _httpCachePolicyBase.AssertWasCalled(arg => arg.SetCacheability(HttpCacheability.ServerAndNoCache)); }