コード例 #1
0
        public void VirtualFoldersCanContainDuplicateFiles()
        {
            Directory.CreateDirectory(testDir);

            var dir1 = Path.Combine(testDir, "test");
            var dir2 = Path.Combine(testDir, "test2");

            var vf = Path.Combine(testDir, "test.vf");

            Directory.CreateDirectory(dir1 + "\\path");
            Directory.CreateDirectory(dir2 + "\\path");


            VirtualFolderContents generator = new VirtualFolderContents("");

            generator.AddFolder(dir1);
            generator.AddFolder(dir2);

            File.WriteAllText(vf, generator.Contents);

            var root = Kernel.Instance.GetLocation <VirtualFolderMediaLocation>(vf);

            Assert.AreEqual(2, root.Children.Count);
            Assert.AreEqual(true, root.ContainsChild("path"));
        }
コード例 #2
0
        public void DodgyVfsShouldPartiallyLoad()
        {
            var vf = Path.Combine(testDir, "test.vf");

            Directory.CreateDirectory(testDir);
            var dir1 = Path.Combine(testDir, "test");

            Directory.CreateDirectory(dir1 + "\\path");

            VirtualFolderContents generator = new VirtualFolderContents("");

            generator.AddFolder(dir1);
            generator.AddFolder(@"\\10.0.0.4\mydir");

            File.WriteAllText(vf, generator.Contents);

            var root = Kernel.Instance.GetLocation <VirtualFolderMediaLocation>(vf);

            Assert.AreEqual(1, root.Children.Count);
        }
コード例 #3
0
 public VirtualFolder(string path)
 {
     this.path = path;
     contents  = new VirtualFolderContents(File.ReadAllText(path));
 }