public void ExecuteResult() { // Arrange Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(MockBehavior.Strict); mockControllerContext.ExpectSet(c => c.HttpContext.Response.StatusCode, 401).Verifiable(); HttpUnauthorizedResult result = new HttpUnauthorizedResult(); // Act result.ExecuteResult(mockControllerContext.Object); // Assert mockControllerContext.Verify(); }
public void ExecuteResult() { // Arrange Mock<ControllerContext> mockControllerContext = new Mock<ControllerContext>(); mockControllerContext.SetupSet(c => c.HttpContext.Response.StatusCode = 401).Verifiable(); mockControllerContext.SetupSet(c => c.HttpContext.Response.StatusDescription = "Some description").Verifiable(); HttpUnauthorizedResult result = new HttpUnauthorizedResult("Some description"); // Act result.ExecuteResult(mockControllerContext.Object); // Assert mockControllerContext.Verify(); }
public void ExecuteResult() { // Arrange Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>(MockBehavior.Strict); mockControllerContext.ExpectSet(c => c.HttpContext.Response.StatusCode, 401).Verifiable(); HttpUnauthorizedResult result = new HttpUnauthorizedResult(); // Act result.ExecuteResult(mockControllerContext.Object); // Assert mockControllerContext.Verify(); }
public void ExecuteResult() { // Arrange Mock <ControllerContext> mockControllerContext = new Mock <ControllerContext>(); mockControllerContext.SetupSet(c => c.HttpContext.Response.StatusCode = 401).Verifiable(); mockControllerContext.SetupSet(c => c.HttpContext.Response.StatusDescription = "Some description").Verifiable(); HttpUnauthorizedResult result = new HttpUnauthorizedResult("Some description"); // Act result.ExecuteResult(mockControllerContext.Object); // Assert mockControllerContext.Verify(); }