public void Elmah_Error() { var routes = new RouteCollection(); Console.WriteLine("Elmah Error View.\n"); MRPEntities db = new MRPEntities(); HttpContext.Current = DataHelper.SetUserAndPermission(); ErrorController objErrorController = new ErrorController(); objErrorController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objErrorController); objErrorController.Url = MockHelpers.FakeUrlHelper.UrlHelper(); var result = objErrorController.ElmahError() as ViewResult; Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + " \n The Assert Value result.ViewName: " + result.ViewName); Assert.IsNotNull(result.ViewName); }