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"); }
public void WhenTheContextIsNull_ThenAnExceptionIsThrown() { var result = new HttpBasicUnauthorizedResult(); Action act = () => result.ExecuteResult(null); act.ShouldThrow<ArgumentNullException>(); }