コード例 #1
0
        public static void SetFakeContext(this ControllerBase controller)
        {
            var sessionContext = new HttpSessionStateBaseFake();
            var httpContext = new HttpContextBaseFake(sessionContext);

            var controllerContext = new ControllerContextFake();
            controllerContext.HttpContext = httpContext;
            controller.ControllerContext = controllerContext;
        }
コード例 #2
0
        public static void SetFakeContext(this ControllerBase controller)
        {
            var sessionContext = new HttpSessionStateBaseFake();
            var httpContext    = new HttpContextBaseFake(sessionContext);

            var controllerContext = new ControllerContextFake();

            controllerContext.HttpContext = httpContext;
            controller.ControllerContext  = controllerContext;
        }