コード例 #1
0
 public void Setup()
 {
     _controllerContext = new ControllerContext {
         HttpContext = MvcMockHelpers.DynamicHttpContextBase()
     };
     _service = new EmailTemplateService();
 }
コード例 #2
0
        public void Setup()
        {
            MvcViewEngines.Engines.Clear();
            MvcViewEngines.Engines.Add(MockRepository.GenerateMock <IViewEngine>());

            _controllerContext = new ControllerContext
            {
                HttpContext = MvcMockHelpers.DynamicHttpContextBase(),
                Controller  = MockRepository.GenerateStub <ControllerBase>()
            };

            _controllerContext.Controller.ViewData = new ViewDataDictionary();
            _controllerContext.Controller.TempData = new TempDataDictionary();

            _service = new EmailTemplateService();

            Response.Stub(x => x.Filter).PropertyBehavior();
            Response.Expect(x => x.ContentEncoding).Return(Encoding.UTF8);
        }
コード例 #3
0
 public void Setup()
 {
     _urlHelper = new UrlHelper(new RequestContext(MvcMockHelpers.DynamicHttpContextBase(), new RouteData()), new RouteCollection());
     _urlHelper.RequestContext.HttpContext.Response.Stub(o => o.ApplyAppPathModifier(null)).IgnoreArguments().Do((Func <string, string>)(s => s));
     _urlHelper.RouteCollection.MapRoute("default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = "" });
 }