예제 #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;
        }
예제 #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 });
        }
예제 #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);
        }
예제 #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");
 }