public async Task MoveFail() { writer.move = true; await diskManager.MoveFilesAsync(rig.Manager, "root", true); Assert.AreEqual(TorrentState.Error, rig.Manager.State); }
public void MoveFail() { writer.move = true; Hookup(); diskManager.MoveFilesAsync(rig.Manager, "root", true).Wait(); CheckFail(); }
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)); }
public void MoveFilesFail() { writer.move = true; Assert.ThrowsAsync <Exception> (() => diskManager.MoveFilesAsync(data, "root", true)); }