protected override TSut Arrange(Func <TSut> controllerCreator)
        {
            var httpContextBase = AutoMocker.CreateHttpContext();

            var controllerContext = new ControllerContext
            {
                RouteData   = new RouteData(),
                HttpContext = httpContextBase
            };

            System.Web.HttpContext.Current = new HttpContext(
                new HttpRequest("", "http://tempuri.org", "")
            {
                RequestContext = new RequestContext(controllerContext.HttpContext, controllerContext.RouteData),
                Browser        = new HttpBrowserCapabilities
                {
                    Capabilities =
                        new Dictionary <string, string> {
                        { "supportsEmptyStringInCookieValue", "false" }, { "cookies", "false" }
                    }
                }
            },
                new HttpResponse(new StringWriter()));

            var controller = base.Arrange(controllerCreator);

            controllerContext.Controller = controller;
            controller.ControllerContext = controllerContext;

            return(controller);
        }
Exemple #2
0
 protected override TFilter Arrange(Func <TFilter> attributeCreator)
 {
     RegisterDependency(AutoMocker.CreateHttpContext());
     return(attributeCreator());
 }