예제 #1
0
            public void Must_respond_with_status_code_and_description(int statusCode, int subStatusCode, string response)
            {
                _response.Stub(arg => arg.StatusCode).Return(new StatusAndSubStatusCode(statusCode, subStatusCode));
                _handler.HandleResponseAsync(_httpContext, _response, null, null);

                _httpResponse.AssertWasCalled(arg => arg.BinaryWrite(Encoding.UTF8.GetBytes(response)));
            }
예제 #2
0
 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));
 }