コード例 #1
0
 public void WhenTheResultIsExecuted_ThenTheAuthenticateHeaderIsAddedToTheCollection()
 {
     var httpContext = new Mock<HttpContextBase>();
     httpContext.Setup(h => h.Response).Returns(new FakeResponse());
     var result = new HttpBasicUnauthorizedResult();
     var context = new ControllerContext();
     context.HttpContext = httpContext.Object;
     result.ExecuteResult(context);
     context.HttpContext.Response.Headers.Should().Contain("WWW-Authenticate");
 }
コード例 #2
0
 public void WhenTheContextIsNull_ThenAnExceptionIsThrown()
 {
     var result = new HttpBasicUnauthorizedResult();
     Action act = () => result.ExecuteResult(null);
     act.ShouldThrow<ArgumentNullException>();
 }