Esempio n. 1
0
        public void SetUp()
        {
            engine = new Fakes.FakeEngine(new Type[] { typeof(ContentHandlerTestsPage), typeof(ContentHandlerTestsPart), typeof(Fakes.FakeNodeAdapter) });
            //engine.Resolve<Fakes.FakeNodeAdapter>().Engine = engine;
            handler = new ContentHandler(engine);
            context = new Fakes.FakeWebContextWrapper();
            context.HttpContext.User = SecurityUtilities.CreatePrincipal("Admin");

            startPage = new ContentHandlerTestsPage {
                Title = "Start page"
            };
            engine.Persister.Save(startPage);
            page = new ContentHandlerTestsPage {
                Title = "Page in question"
            };
            page.AddTo(startPage);
            engine.Persister.Save(page);

            engine.AddComponentInstance <IWebContext>(context);
            engine.AddComponentInstance <IUrlParser>(new Fakes.FakeUrlParser(startPage: startPage));
            var persister         = engine.Persister;
            var activator         = engine.Resolve <ContentActivator>();
            var versionRepository = TestSupport.CreateVersionRepository(ref persister, ref activator, new Type[] { typeof(ContentHandlerTestsPage), typeof(ContentHandlerTestsPart) });

            engine.AddComponentInstance <ContentVersionRepository>(versionRepository);
            engine.AddComponentInstance <VersionManager>(versionManager = TestSupport.SetupVersionManager(engine.Persister, versionRepository));
            (engine.Resolve <IContentAdapterProvider>() as N2.Plugin.IAutoStart).Start();
            engine.Resolve <IContentAdapterProvider>().ResolveAdapter <N2.Edit.NodeAdapter>(typeof(ContentItem)).Engine = engine;
            engine.AddComponentInstance(new HtmlSanitizer(new N2.Configuration.HostSection()));
            engine.AddComponentInstance <IEditUrlManager>(new FakeEditUrlManager());
            engine.AddComponentInstance(new ConfigurationManagerWrapper());
            engine.AddComponentInstance <ILanguageGateway>(new FakeLanguageGateway());

            engine.AddComponentInstance(new DraftRepository(versionRepository, new FakeCacheWrapper()));
        }
Esempio n. 2
0
		public void SetUp()
		{
			engine = new Fakes.FakeEngine(new Type[] { typeof(ContentHandlerTestsPage), typeof(ContentHandlerTestsPart), typeof(Fakes.FakeNodeAdapter) });
			//engine.Resolve<Fakes.FakeNodeAdapter>().Engine = engine;
			handler = new ContentHandler(engine);
			context = new Fakes.FakeWebContextWrapper();
			context.HttpContext.User = SecurityUtilities.CreatePrincipal("Admin");

			startPage = new ContentHandlerTestsPage { Title = "Start page" };
			engine.Persister.Save(startPage);
			page = new ContentHandlerTestsPage { Title = "Page in question" };
			page.AddTo(startPage);
			engine.Persister.Save(page);
			
			engine.AddComponentInstance<IWebContext>(context);
			engine.AddComponentInstance<IUrlParser>(new Fakes.FakeUrlParser(startPage: startPage));
			var persister = engine.Persister;
			var activator = engine.Resolve<ContentActivator>();
			var versionRepository = TestSupport.CreateVersionRepository(ref persister, ref activator, new Type[] { typeof(ContentHandlerTestsPage), typeof(ContentHandlerTestsPart) });
			engine.AddComponentInstance<ContentVersionRepository>(versionRepository);
			engine.AddComponentInstance<VersionManager>(versionManager = TestSupport.SetupVersionManager(engine.Persister, versionRepository));
			(engine.Resolve<IContentAdapterProvider>() as N2.Plugin.IAutoStart).Start();
			engine.Resolve<IContentAdapterProvider>().ResolveAdapter<N2.Edit.NodeAdapter>(typeof(ContentItem)).Engine = engine;
			engine.AddComponentInstance(new HtmlSanitizer(new N2.Configuration.HostSection()));
			engine.AddComponentInstance<IEditUrlManager>(new FakeEditUrlManager());
			engine.AddComponentInstance(new ConfigurationManagerWrapper());
			engine.AddComponentInstance<ILanguageGateway>(new FakeLanguageGateway());

			engine.AddComponentInstance(new DraftRepository(versionRepository, new FakeCacheWrapper()));
		}
		public void TestFixtureSetUp()
		{
			TestSupport.InitializeHttpContext("/", "");

			N2.Context.Replace(engine = new Fakes.FakeEngine(typeof(EditableAdapter), typeof(DecoratedItem), typeof(DecoratedItem2), typeof(OtherItem)));
			engine.Initialize();
			engine.AddComponentInstance<IEditManager>(new EditManager(
				engine.Definitions,
				engine.Persister,
				MockRepository.GenerateStub<IVersionManager>(),
				new Fakes.FakeSecurityManager(),
				MockRepository.GenerateStub<IPluginFinder>(),
				new Fakes.FakeEditUrlManager(),
				new N2.Edit.Workflow.StateChanger(),
				new EditableHierarchyBuilder(new Fakes.FakeSecurityManager(), new N2.Configuration.EngineSection()),
				new N2.Configuration.EditSection()));
			engine.AddComponentInstance(new N2.Web.Slug(new N2.Configuration.ConfigurationManagerWrapper()));
		}
Esempio n. 4
0
        public void TestFixtureSetUp()
        {
            TestSupport.InitializeHttpContext("/", "");

            N2.Context.Replace(engine = new Fakes.FakeEngine(typeof(EditableAdapter), typeof(DecoratedItem), typeof(DecoratedItem2), typeof(OtherItem)));
            engine.Initialize();
            engine.AddComponentInstance <IEditManager>(new EditManager(
                                                           engine.Definitions,
                                                           engine.Persister,
                                                           MockRepository.GenerateStub <IVersionManager>(),
                                                           new Fakes.FakeSecurityManager(),
                                                           MockRepository.GenerateStub <IPluginFinder>(),
                                                           new Fakes.FakeEditUrlManager(),
                                                           new N2.Edit.Workflow.StateChanger(),
                                                           new EditableHierarchyBuilder(new Fakes.FakeSecurityManager(), new N2.Configuration.EngineSection()),
                                                           new N2.Configuration.EditSection()));
            engine.AddComponentInstance(new N2.Web.Slug(new N2.Configuration.ConfigurationManagerWrapper()));
        }
Esempio n. 5
0
		public void SetUp()
		{
			engine = new Fakes.FakeEngine(new Type[] { typeof(ContentHandlerTestsPage) });
			handler = new ContentHandler(engine);
			context = new Fakes.FakeWebContextWrapper();
			context.HttpContext.User = SecurityUtilities.CreatePrincipal("Admin");

			startPage = new ContentHandlerTestsPage { Title = "Start page" };
			engine.Persister.Save(startPage);
			page = new ContentHandlerTestsPage { Title = "Page in question" };
			page.AddTo(startPage);
			engine.Persister.Save(page);
			
			engine.AddComponentInstance<IWebContext>(context);
			engine.AddComponentInstance<IUrlParser>(new Fakes.FakeUrlParser(startPage: startPage));
			var versionRepository = TestSupport.CreateVersionRepository(new Type[] { typeof(ContentHandlerTestsPage) });
			engine.AddComponentInstance<ContentVersionRepository>(versionRepository);
			engine.AddComponentInstance<VersionManager>(versionManager = TestSupport.SetupVersionManager(engine.Persister, versionRepository));
		}
Esempio n. 6
0
        public void SetUp()
        {
            engine  = new Fakes.FakeEngine(new Type[] { typeof(ContentHandlerTestsPage) });
            handler = new ContentHandler(engine);
            context = new Fakes.FakeWebContextWrapper();
            context.HttpContext.User = SecurityUtilities.CreatePrincipal("Admin");

            startPage = new ContentHandlerTestsPage {
                Title = "Start page"
            };
            engine.Persister.Save(startPage);
            page = new ContentHandlerTestsPage {
                Title = "Page in question"
            };
            page.AddTo(startPage);
            engine.Persister.Save(page);

            engine.AddComponentInstance <IWebContext>(context);
            engine.AddComponentInstance <IUrlParser>(new Fakes.FakeUrlParser(startPage: startPage));
            var versionRepository = TestSupport.CreateVersionRepository(new Type[] { typeof(ContentHandlerTestsPage) });

            engine.AddComponentInstance <ContentVersionRepository>(versionRepository);
            engine.AddComponentInstance <VersionManager>(versionManager = TestSupport.SetupVersionManager(engine.Persister, versionRepository));
        }
Esempio n. 7
0
 public void SetUp()
 {
     Context.Replace(engine = new Fakes.FakeEngine(new[] { typeof(DecoratedItem), typeof(DecoratedItem2) }));
     engine.AddComponentInstance <ITemplateAggregator>(new TemplateAggregator(engine.Definitions, new ITemplateProvider[] { new TemplateProvider(TestSupport.SetupContentActivator(), map = new DefinitionMap()) }));
 }
Esempio n. 8
0
        public void SetUp()
        {
            Context.Replace(engine = new Fakes.FakeEngine(new[] { typeof(DecoratedItem), typeof(DecoratedItem2) }));
			engine.AddComponentInstance<ITemplateAggregator>(new TemplateAggregator(engine.Definitions, new ITemplateProvider[] { new TemplateProvider(TestSupport.SetupContentActivator(), map = new DefinitionMap()) }));
        }