Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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 });
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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");
 }