public void GeneralTest() { using (ShimsContext.Create()) { ErrorsController controller = new ErrorsController(); string errorMsg = "TestException"; string controllerName = "Error"; string actionName = "General"; Exception ex = new Exception(errorMsg); controller.ControllerContext = GetErrorControllerContext(actionName, controllerName); ViewResult result = controller.General(ex) as ViewResult; ErrorViewModel viewModel = result.ViewData.Model as ErrorViewModel; Assert.IsNotNull(result); Assert.IsTrue(result.ViewName.Equals("ErrorInfo")); Assert.IsNotNull(viewModel); Assert.IsTrue(viewModel.ErrorInformationText.Equals(errorMsg)); Assert.IsTrue(viewModel.ErrorAction.Equals(actionName)); Assert.IsTrue(viewModel.ErrorController.Equals(controllerName)); } }