public override void SetUp() { base.SetUp(); UrlParser inner = new UrlParser(persister, wrapper, host, new HostSection()); parser = new CachingUrlParserDecorator(inner, persister); CreateDefaultStructure(); repository = (FakeRepository<ContentItem>) persister.Repository; }
public override void SetUp() { base.SetUp(); CreateDefaultStructure(); webContext = new FakeWebContextWrapper("http://www.n2cms.com/"); hostSection = new HostSection {Web = new WebElement {ObserveEmptyExtension = true}}; parser = new UrlParser(persister, webContext, new Host(webContext, startItem.ID, startItem.ID), hostSection); }
public void PagesOutsideStartPage_AreReferenced_ThroughTheirRewrittenUrl() { host = new Host(wrapper, 10, 1); parser = new UrlParser(persister, wrapper, host, new HostSection()); CreateDefaultStructure(); ContentItem root = CreateOneItem<PageItem>(10, "root", null); startItem.AddTo(root); ContentItem outside1 = CreateOneItem<PageItem>(11, "outside1", root); mocks.ReplayAll(); Assert.AreEqual(parser.BuildUrl(root), root.FindPath(PathData.DefaultAction).RewrittenUrl.ToString()); Assert.AreEqual(parser.BuildUrl(outside1), outside1.FindPath(PathData.DefaultAction).RewrittenUrl.ToString()); }
public override void SetUp() { base.SetUp(); root = CreateOneItem<RegularPage>(1, "root", null); about = CreateOneItem<AboutUsSectionPage>(2, "about", root); executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about); search = CreateOneItem<SearchPage>(4, "search", root); var typeFinder = new FakeTypeFinder2(); typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes() .BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray(); typeFinder.typeMap[typeof(IController)] = this.NearbyTypes() .BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController)) .ToArray(); var changer = new StateChanger(); var definitions = new DefinitionManager(new[] { new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), typeFinder, new EngineSection())) }, new ITemplateProvider[0], new ContentActivator(changer, null, new EmptyProxyFactory()), changer); var webContext = new ThreadContext(); var host = new Host(webContext, root.ID, root.ID); var parser = new UrlParser(persister, webContext, host, new HostSection()); controllerMapper = new ControllerMapper(typeFinder, definitions); Url.DefaultExtension = ""; engine = mocks.DynamicMock<IEngine>(); SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder); SetupResult.For(engine.Definitions).Return(definitions); SetupResult.For(engine.UrlParser).Return(parser); SetupResult.For(engine.Persister).Return(persister); var editUrlManager = new FakeEditUrlManager(); SetupResult.For(engine.ManagementPaths).Return(editUrlManager); engine.Replay(); route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null); httpContext = new FakeHttpContext(); routes = new RouteCollection { route }; }
public override void SetUp() { base.SetUp(); base.parser = parser = new UrlParser(persister, wrapper, host, new HostSection()); CreateDefaultStructure(); }
public override void SetUp() { base.SetUp(); base.parser = parser = TestSupport.Setup(persister, wrapper, host); CreateDefaultStructure(); }
private void InitializeUrlParser(IServiceContainer container) { var config = container.Resolve<HostSection>(); IUrlParser parser; if (config.MultipleSites) parser = new MultipleSitesParser(container.Resolve<IPersister>(), container.Resolve<IWebContext>(), container.Resolve<IHost>(), container.Resolve<Plugin.ConnectionMonitor>(), config); else parser = new UrlParser(container.Resolve<IPersister>(), container.Resolve<IWebContext>(), container.Resolve<IHost>(), container.Resolve<Plugin.ConnectionMonitor>(), config); if (config.Web.Urls.EnableCaching) parser = new CachingUrlParserDecorator(parser, container.Resolve<IPersister>(), container.Resolve<IWebContext>(), container.Resolve<CacheWrapper>()); container.AddComponentInstance("n2.urlParser", typeof(IUrlParser), parser); }