public AbstractControllerTest() { m_mockAbstractController = new MockAbstractController(); m_mockHttpContext = MockHttpFactory.GetHttpContext(); ControllerContext controllerContext = new ControllerContext(new RequestContext(m_mockHttpContext.Object, new RouteData()), m_mockAbstractController); m_mockAbstractController.ControllerContext = controllerContext; }
public AjaxRedirectToRouteResultTest() { m_mockHttpContext = MockHttpFactory.GetHttpContext(); m_controllerContext = new ControllerContext(new RequestContext(m_mockHttpContext.Object, new RouteData()), new Mock <AbstractController>().Object); m_action = new AjaxRedirectToRouteResult(new RouteValueDictionary(new { Controller = "c", Action = "a", Id = "i" })); RouteTable.Routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = string.Empty }); }
public CompressAttributeTest() { var mockHttpContext = MockHttpFactory.GetHttpContext(); var mockFilterStream = new Mock <Stream>(MockBehavior.Strict); mockHttpContext.SetupGet(context => context.Request.Headers).Returns(new NameValueCollection()); mockHttpContext.SetupProperty(context => context.Response.Filter, mockFilterStream.Object); mockFilterStream.SetupGet(filter => filter.CanWrite).Returns(true); ControllerContext controllerContext = new ControllerContext(new RequestContext(mockHttpContext.Object, new RouteData()), new Mock <AbstractController>().Object); m_filterContext = new ResultExecutedContext(controllerContext, new ContentResult(), false, null); }
public AjaxRedirectResultTest() { m_mockHttpContext = MockHttpFactory.GetHttpContext(); m_controllerContext = new ControllerContext(new RequestContext(m_mockHttpContext.Object, new RouteData()), new Mock <AbstractController>().Object); m_action = new AjaxRedirectResult("/c/a/i"); }