public ControllerTestContext(ControllerBase controller) { ViewEngine = new MockViewEngine(); TestContext = new HttpContextTestContext(); var controllerContext = new ControllerContext( new RequestContext(TestContext.Context, new RouteData()), controller); controller.ControllerContext = controllerContext; }