コード例 #1
0
        public async Task MoveFail()
        {
            writer.move = true;
            await diskManager.MoveFilesAsync(rig.Manager, "root", true);

            Assert.AreEqual(TorrentState.Error, rig.Manager.State);
        }
コード例 #2
0
 public void MoveFail()
 {
     writer.move = true;
     Hookup();
     diskManager.MoveFilesAsync(rig.Manager, "root", true).Wait();
     CheckFail();
 }
コード例 #3
0
        public async Task MoveFiles_Overwrite_SameDir()
        {
            using var tmp = TempDir.Create();

            var file = TorrentFileInfo.Create(Constants.BlockSize, (Path.Combine("sub_dir", "orig.txt"), 123456, Path.Combine(tmp.Path, "sub_dir", "orig.txt"))).Single();

            Directory.CreateDirectory(Path.GetDirectoryName(file.FullPath));
            File.OpenWrite(file.FullPath).Close();

            using var writer  = new TestPieceWriter();
            using var manager = new DiskManager(new EngineSettings(), Factories.Default, writer);

            await manager.MoveFilesAsync(new[] { file }, tmp.Path, true);

            Assert.AreEqual(Path.Combine(tmp.Path, file.Path), file.FullPath);
            Assert.IsTrue(File.Exists(file.FullPath));
        }
コード例 #4
0
 public void MoveFilesFail()
 {
     writer.move = true;
     Assert.ThrowsAsync <Exception> (() => diskManager.MoveFilesAsync(data, "root", true));
 }