Example #1
0
        public override void SetUp()
        {
            base.SetUp();

            root = CreateOneItem<Items.NormalPage>(1, "root", null);
            start = CreateOneItem<Items.NormalPage>(2, "start", root);
            part = CreateOneItem<Items.NormalItem>(3, "part", root);
            part.ZoneName = "Zone";

            adapter = new NodeAdapter();
            adapter.ManagementPaths = new EditUrlManager(null, new N2.Configuration.EditSection());
            adapter.FileSystem = fs = new FakeMemoryFileSystem();
            adapter.NodeFactory = new VirtualNodeFactory();
            adapter.WebContext = new Fakes.FakeWebContextWrapper();
            adapter.Security = new SecurityManager(adapter.WebContext, new N2.Configuration.EditSection());
            adapter.Host = new Host(null, root.ID, start.ID);
            adapter.Settings = new FakeNavigationSettings();
            adapter.Sources = TestSupport.SetupContentSource(adapter.WebContext, adapter.Host, persister.Repository);
        }
Example #2
0
		public void TracksUrl_ToItemsWithoutId()
		{
			RootDirectory rootDir = CreateOneItem<RootDirectory>(4, "FileSystem", root);
			((IInjectable<IUrlParser>)rootDir).Set(TestSupport.Setup(persister, new FakeWebContextWrapper(), new Host(null, 1, 1)));
			var fs = new FakeMemoryFileSystem();
			fs.files["/FileSystem/upload/File.txt"] = new FileData { Name = "File.txt" };
			rootDir.Set(fs);
			rootDir.Set(new ImageSizeCache(new ConfigurationManagerWrapper { Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, new EditSection()) }));

			root["TestDetail"] = @"<a href=""/FileSystem/upload/File.txt"">download pdf</a>";
			persister.Save(root);

			DetailCollection links = root.GetDetailCollection("TrackedLinks", false);
			Assert.That(links, Is.Not.Null);
			Assert.That(links.Details[0].LinkedItem, Is.Null);
			Assert.That(links.Details[0].StringValue, Is.EqualTo("/FileSystem/upload/File.txt"));
		}
Example #3
0
		private void SetupFileSystem(out RootDirectory rootDir, out FakeMemoryFileSystem fs)
		{
			rootDir = CreateOneItem<RootDirectory>(4, "FileSystem", root);
			((IInjectable<IUrlParser>)rootDir).Set(TestSupport.Setup(persister, new FakeWebContextWrapper(), new Host(null, 1, 1)));
			fs = new FakeMemoryFileSystem();
			fs.directories["/FileSystem/upload/"] = new DirectoryData { Name = "upload" };
		
			rootDir.Set(fs);
			rootDir.Set(new ImageSizeCache(new ConfigurationManagerWrapper { Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, new EditSection()) }));
			
			var injector = new FakeDependencyInjector();
			injector.injectors.Add(new EntityDependencySetter<IFileSystem>(fs));
			injector.injectors.Add(new EntityDependencySetter<ImageSizeCache>(new ImageSizeCache(new ConfigurationManagerWrapper())));
			rootDir.Set(injector);
		}