Beispiel #1
0
        public void CanFailWhenSavingFileOverDirectory()
        {
            string parent1 = "/parent1";
            string file1   = parent1 + "/sub1";

            TestVolume.CreateDirectory(VolumePath.FromString(file1));
            TestVolume.SaveFile(VolumePath.FromString(file1), new FileContent());
        }
Beispiel #2
0
        public void CanFailWhenCreatingDirectoryOverExistingDirectory()
        {
            string parent = "/parent1";
            string dir    = parent + "/sub1";

            TestVolume.CreateDirectory(VolumePath.FromString(dir));
            TestVolume.CreateDirectory(VolumePath.FromString(dir));
        }
Beispiel #3
0
        public void CanDeleteNonExistingDirectories()
        {
            VolumePath path = VolumePath.FromString("/abc");

            TestVolume.CreateDirectory(path);
            TestVolume.Delete(path);
            TestVolume.Delete(path);
        }
Beispiel #4
0
        public void CanFailWhenCreatingDirectoryOverFile()
        {
            string parent1 = "/parent1";
            string file1   = parent1 + "/sub1";

            TestVolume.CreateFile(VolumePath.FromString(file1));
            TestVolume.CreateDirectory(VolumePath.FromString(file1));
        }
Beispiel #5
0
        public void CanCreateDirectories()
        {
            string dir1 = "/testdir", dir2 = "/abc", dir3 = "/abc2", dir4 = "/abc/subdirectory";

            Assert.AreEqual(0, TestVolume.Root.List().Count);

            TestVolume.CreateDirectory(VolumePath.FromString(dir1));
            TestVolume.CreateDirectory(VolumePath.FromString(dir2));
            TestVolume.CreateDirectory(VolumePath.FromString(dir3));
            TestVolume.CreateDirectory(VolumePath.FromString(dir4));

            Assert.AreEqual(3, TestVolume.Root.List().Count);
            Assert.AreEqual(dir2, TestVolume.Root.List()["abc"].Path.ToString());
            Assert.AreEqual(dir3, TestVolume.Root.List()["abc2"].Path.ToString());
            Assert.AreEqual(dir1, TestVolume.Root.List()["testdir"].Path.ToString());

            Assert.AreEqual(1, (TestVolume.Root.List()["abc"] as VolumeDirectory).List().Values.Count);
            Assert.AreEqual(dir4, (TestVolume.Root.List()["abc"] as VolumeDirectory).List()["subdirectory"].Path.ToString());
        }
Beispiel #6
0
        public void CanDeleteDirectories()
        {
            string parent1 = "/parent1", parent2 = "/parent2";
            string dir1 = parent1 + "/sub1", dir2 = parent1 + "/sub2", dir3 = parent2 + "/sub3";

            TestVolume.CreateDirectory(VolumePath.FromString(dir1));
            TestVolume.CreateDirectory(VolumePath.FromString(dir2));
            TestVolume.CreateDirectory(VolumePath.FromString(dir3));

            VolumeDirectory parent = TestVolume.Open(VolumePath.FromString(parent1)) as VolumeDirectory;

            TestVolume.Delete(VolumePath.FromString(dir1));
            Assert.AreEqual(1, parent.List().Count);
            Assert.AreEqual(dir2, parent.List()["sub2"].Path.ToString());

            TestVolume.Delete(VolumePath.FromString(parent2));
            Assert.AreEqual(1, TestVolume.Root.List().Count);
            Assert.AreEqual(parent1, TestVolume.Root.List()["parent1"].Path.ToString());
        }
Beispiel #7
0
 public void CanFailWhenCreatingDirectoryOverRootDirectory()
 {
     TestVolume.CreateDirectory(VolumePath.FromString("/"));
 }
Beispiel #8
0
        public void CanFailWhenCreatingDirectoryWithNegativeDepth()
        {
            string dir = "/../test";

            TestVolume.CreateDirectory(VolumePath.FromString(dir));
        }