public void CanFailWhenSavingFileOverDirectory() { string parent1 = "/parent1"; string file1 = parent1 + "/sub1"; TestVolume.CreateDirectory(VolumePath.FromString(file1)); TestVolume.SaveFile(VolumePath.FromString(file1), new FileContent()); }
public void CanFailWhenCreatingDirectoryOverExistingDirectory() { string parent = "/parent1"; string dir = parent + "/sub1"; TestVolume.CreateDirectory(VolumePath.FromString(dir)); TestVolume.CreateDirectory(VolumePath.FromString(dir)); }
public void CanDeleteNonExistingDirectories() { VolumePath path = VolumePath.FromString("/abc"); TestVolume.CreateDirectory(path); TestVolume.Delete(path); TestVolume.Delete(path); }
public void CanFailWhenCreatingDirectoryOverFile() { string parent1 = "/parent1"; string file1 = parent1 + "/sub1"; TestVolume.CreateFile(VolumePath.FromString(file1)); TestVolume.CreateDirectory(VolumePath.FromString(file1)); }
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()); }
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()); }
public void CanFailWhenCreatingDirectoryOverRootDirectory() { TestVolume.CreateDirectory(VolumePath.FromString("/")); }
public void CanFailWhenCreatingDirectoryWithNegativeDepth() { string dir = "/../test"; TestVolume.CreateDirectory(VolumePath.FromString(dir)); }