Ejemplo 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()));
        }
Ejemplo 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 override void TestFixtureSetup()
 {
     FakeWebContextWrapper context = new Fakes.FakeWebContextWrapper();
     DatabaseSection config = (DatabaseSection)ConfigurationManager.GetSection("n2/database");
     TestSupport.Setup(out definitions, out activator, out notifier, out sessionProvider, out finder, out schemaCreator, out proxyFactory,
         context, config,
         new [] { new SearchConfigurationBuilderParticipator(context, config) }, persistedTypes);
 }
Ejemplo n.º 4
0
        public override void TestFixtureSetup()
        {
            FakeWebContextWrapper context = new Fakes.FakeWebContextWrapper();
            DatabaseSection       config  = (DatabaseSection)ConfigurationManager.GetSection("n2/database");

            TestSupport.Setup(out definitions, out activator, out notifier, out sessionProvider, out finder, out schemaCreator, out proxyFactory,
                              context, config,
                              new [] { new SearchConfigurationBuilderParticipator(context, config) }, persistedTypes);
        }
Ejemplo 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));
		}
Ejemplo 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));
        }