public override void SetUp() { base.SetUp(); DefinitionBuilder builder = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection()); IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>(); mocks.Replay(notifier); var changer = new N2.Edit.Workflow.StateChanger(); definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ContentActivator(changer, notifier, new EmptyProxyFactory()), changer, new DefinitionMap()); versioner = mocks.StrictMock<IVersionManager>(); var urls = new FakeEditUrlManager(); editManager = new EditManager(definitions, persister, versioner, null, null, urls, changer, new EditableHierarchyBuilder(new SecurityManager(new ThreadContext(), new EditSection()), TestSupport.SetupEngineSection()), new EditSection()); editManager.EnableVersioning = true; var engine = new FakeEngine(); engine.Container.AddComponentInstance("editManager", typeof(IEditManager), editManager); engine.Container.AddComponentInstance("editSection", typeof(EditSection), new EditSection()); Context.Replace(engine); }
public override void SetUp() { base.SetUp(); var urls = new FakeEditUrlManager(); DefinitionBuilder builder = new DefinitionBuilder(typeFinder, new EngineSection(), urls); IItemNotifier notifier = mocks.DynamicMock<IItemNotifier>(); mocks.Replay(notifier); var changer = new N2.Edit.Workflow.StateChanger(); DefinitionManager definitions = new DefinitionManager(builder, changer, notifier, new EmptyProxyFactory()); versioner = mocks.StrictMock<IVersionManager>(); editManager = new EditManager(definitions, persister, versioner, null, null, null, urls, changer, new EditSection()); editManager.EnableVersioning = true; var engine = new FakeEngine(); engine.AddComponentInstance("editManager", typeof(IEditManager), editManager); engine.AddComponentInstance("editSection", typeof(EditSection), new EditSection()); Context.Replace(engine); }
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 TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection())) }, new ITemplateProvider[0], new ContentActivator(changer, null, new EmptyProxyFactory()), changer); httpContext = new FakeHttpContext(); var webContext = new FakeWebContextWrapper(httpContext); var host = new Host(webContext, root.ID, root.ID); var parser = TestSupport.Setup(persister, webContext, host); controllerMapper = new ControllerMapper(typeFinder, definitions); Url.DefaultExtension = ""; N2.Web.Url.ApplicationPath = "/"; 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); SetupResult.For(engine.Resolve<RequestPathProvider>()).Return(new RequestPathProvider(webContext, parser, new ErrorNotifier(), new HostSection())); var editUrlManager = new FakeEditUrlManager(); SetupResult.For(engine.ManagementPaths).Return(editUrlManager); engine.Replay(); route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null); routes = new RouteCollection { route }; }
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 editUrlManager = new FakeEditUrlManager(); var definitions = new DefinitionManager(new DefinitionBuilder(typeFinder, new EngineSection(), editUrlManager), new N2.Edit.Workflow.StateChanger(), null, new EmptyProxyFactory()); 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); SetupResult.For(engine.ManagementPaths).Return(editUrlManager); engine.Replay(); route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null); httpContext = new FakeHttpContext(); routes = new RouteCollection { route }; }