public void OnException_OtherException_DoesNotDirectlyHandleException() { Mock<ControllerContext> controllerContext = new Mock<ControllerContext>(); MockController controller = new MockController { ControllerContext = controllerContext.Object }; ExceptionContext context = controller.MockThrowingOtherException(); Assert.That(context.ExceptionHandled, Is.False); }
public void OnException_404Exception_HandlesException() { Mock<ControllerContext> controllerContext = new Mock<ControllerContext>(); controllerContext.SetupSet(cc => cc.HttpContext.Response.StatusCode = It.IsAny<int>()); SetupViewEngineStub(); MockController controller = new MockController { ControllerContext = controllerContext.Object }; ExceptionContext context = controller.MockThrowing404Exception(); Assert.That(context.ExceptionHandled, Is.True); }