public void Setup() { HttpContext.Current = MockHelperFactory.FakeHttpContext(); var item = RouteTable.Routes.Cast <Route>().SingleOrDefault(r => r.Url == "{year}/{month}/{url}/{status}"); if (item == null) { var routeValueDictionary = new RouteValueDictionary { { "controller", "Home" }, { "action", "View" }, { "status", UrlParameter.Optional } }; var constraintDictionary = new RouteValueDictionary { { "year", @"\d{4}" }, { "month", @"[0-9]{1,2}" }, { "url", @"\S+" }, { "status", @"[a-z\-]*" } }; RouteTable.Routes.Add("IndividualPost", new Route("{year}/{month}/{url}/{status}", routeValueDictionary, constraintDictionary, null)); } }
public void Setup() { HttpContext.Current = MockHelperFactory.FakeHttpContext(); var item = RouteTable.Routes.Cast <Route>().SingleOrDefault(r => r.Url == "pages/{pageUrl}/{status}"); if (item == null) { var routeValueDictionary = new RouteValueDictionary { { "controller", "ViewPage" }, { "action", "Index" }, { "status", UrlParameter.Optional } }; var constraintDictionary = new RouteValueDictionary { { "pageUrl", @"\S+" }, { "status", @"[a-z\-]*" } }; RouteTable.Routes.Add("Pages", new Route("pages/{pageUrl}/{status}", routeValueDictionary, constraintDictionary, null)); } }
public IntegrationTest() { _dataContext = DataContextHelper.GetDataContext(); IHttpContextAccessor httpContextAccessor = MockHelperFactory.GetHttpContextWithUser().Object; ILoggerService loggerService = MockHelperFactory.GetLoggerService().Object; _crudRepository = new CRUDRepository(_dataContext, loggerService, httpContextAccessor); }
public void Setup() { HttpContext.Current = MockHelperFactory.FakeHttpContext(); }