public void FileNoCollision() { using (TemporaryFolder folder1 = new TemporaryFolder(), folder2 = new TemporaryFolder()) { var file = folder1.CreateFile(); var rule = new MoveRule { Destination = folder2.Path }; rule.Apply(file.FileInfo, environment); Assert.IsFalse(folder1.Files.Any(x => x.Name == file.Name)); Assert.IsTrue(folder2.Files.Any(x => x.Name == file.Name)); } }
public void FileIfExistsCancel() { using (TemporaryFolder folder1 = new TemporaryFolder(), folder2 = new TemporaryFolder()) { var file1 = folder1.CreateFile(); var file2 = folder2.CreateFile(file1.Name); var rule = new MoveRule { Destination = folder2.Path, IfExists = MoveRule.IfExistsMode.Cancel }; rule.Apply(file1.FileInfo, environment); Assert.IsTrue(folder1.Files.Any(x => x.Name == file1.Name)); Assert.AreEqual(1, folder2.Files.Count()); } }
public void FileNoCollision() { using( TemporaryFolder folder1 = new TemporaryFolder(), folder2 = new TemporaryFolder() ) { var file = folder1.CreateFile(); var rule = new MoveRule { Destination = folder2.Path }; rule.Apply(file.FileInfo, environment); Assert.IsFalse(folder1.Files.Any(x => x.Name == file.Name)); Assert.IsTrue(folder2.Files.Any(x=>x.Name==file.Name)); } }