Esempio n. 1
0
        public void CanMoveDirectoryToRootDirectory()
        {
            GlobalPath targetPath = GlobalPath.FromString("1:");

            Assert.IsTrue(volumeManager.Move(dir1Path, targetPath));
            Assert.IsFalse(SourceVolume.Exists(dir1Path));
        }
Esempio n. 2
0
        public void CanMoveFileByCookedName()
        {
            var        sourcePath = dir1Path.Combine("file3");
            GlobalPath targetPath = GlobalPath.FromString("1:");

            Assert.IsTrue(volumeManager.Move(sourcePath, targetPath));

            Assert.IsFalse(SourceVolume.Exists(sourcePath));
            Assert.AreEqual(1, TargetVolume.Root.List().Count);
            Assert.IsTrue(TargetVolume.Root.List()[file3] is VolumeFile);
        }
Esempio n. 3
0
        public void CanMoveFileToNewFile()
        {
            Assert.IsTrue(volumeManager.Move(subsubdir1File1Path, GlobalPath.FromString("1:/dir1/file1")));

            Assert.IsFalse(SourceVolume.Exists(subsubdir1File1Path));
            Assert.AreEqual(1, TargetVolume.Root.List().Count);
            VolumeDirectory parent = (TargetVolume.Open(dir1Path) as VolumeDirectory);

            Assert.AreEqual(1, parent.List().Count);
            Assert.AreEqual("subsubdir1File1\n", (parent.List()[file1] as VolumeFile).ReadAll().String);
        }
Esempio n. 4
0
        public void CanMoveEvenIfThereIsNoSpaceOnSameVolume()
        {
            if (SourceVolume.Capacity == Volume.INFINITE_CAPACITY)
            {
                Assert.Pass();
                return;
            }

            (SourceVolume.Open(subsubdir1File1Path) as VolumeFile)
            .WriteLn(new string('a', (int)SourceVolume.Capacity / 2 + 1));
            Assert.IsTrue(volumeManager.Move(subdir1Path, GlobalPath.FromString("0:/newname")));
        }
Esempio n. 5
0
        public void CanFailToMoveWhenTheresNoSpaceOnTargetVolume()
        {
            if (TargetVolume.Capacity == Volume.INFINITE_CAPACITY)
            {
                Assert.Pass();
                return;
            }

            (SourceVolume.Open(subsubdir1File1Path) as VolumeFile)
            .WriteLn(new string('a', (int)TargetVolume.Capacity / 2 + 1));
            Assert.IsTrue(volumeManager.Copy(subdir1Path, GlobalPath.FromString("1:/copy1")));
            Assert.IsFalse(volumeManager.Move(subdir1Path, GlobalPath.FromString("1:/copy2")));
        }
Esempio n. 6
0
        public void CanFailToCopyDirectoryIfThereIsNoSpaceToCopy()
        {
            if (TargetVolume.Capacity == Volume.INFINITE_CAPACITY)
            {
                Assert.Pass();
                return;
            }

            (SourceVolume.Open(subsubdir1File1Path) as VolumeFile)
            .WriteLn(new string('a', (int)TargetVolume.Capacity / 4 + 1));
            SourceVolume.CreateFile(subdir1Path.Combine("other"))
            .WriteLn(new string('a', (int)TargetVolume.Capacity / 4 + 1));
            Assert.IsTrue(volumeManager.Copy(subdir1Path, GlobalPath.FromString("1:/copy1")));
            Assert.IsFalse(volumeManager.Copy(subdir1Path, GlobalPath.FromString("1:/copy2")));
        }
Esempio n. 7
0
        public void SetupVolumes()
        {
            dir1Path       = GlobalPath.FromString("0:" + dir1);
            subdir1Path    = dir1Path.Combine(subdir1);
            subdir2Path    = dir1Path.Combine(subdir2);
            subsubdir1Path = subdir1Path.Combine(subsubdir1);

            file1Path           = GlobalPath.FromString("0:" + file1);
            dir1File1Path       = dir1Path.Combine(file1);
            dir1File2Path       = dir1Path.Combine(file2);
            dir1File3Path       = dir1Path.Combine(file3);
            subdir1File1Path    = subdir1Path.Combine(file1);
            subsubdir1File1Path = subsubdir1Path.Combine(file1);

            SourceVolume.Clear();
            TargetVolume.Clear();

            SourceVolume.CreateDirectory(subdir2Path);
            SourceVolume.CreateDirectory(subsubdir1Path);

            SourceVolume.CreateFile(file1Path).WriteLn(file1);
            SourceVolume.CreateFile(dir1File3Path).WriteLn(file2);
            SourceVolume.CreateFile(subsubdir1File1Path).WriteLn("subsubdir1File1");
        }
 private void Obs_SourceVolumeChanged(OBSWebsocket sender, SourceVolume volume)
 {
     LogMessage($"[SourceVolumeChanged] Source: {volume.SourceName} Volume: {volume.Volume} VolumeDB: {volume.VolumeDb}");
 }
Esempio n. 9
0
 public void CanMoveDirectoryToExistingDirectory()
 {
     TargetVolume.CreateDirectory(VolumePath.FromString("/newdirectory"));
     Assert.IsTrue(volumeManager.Move(dir1Path, GlobalPath.FromString("1:/newdirectory")));
     Assert.IsFalse(SourceVolume.Exists(dir1Path));
 }