public void If_1_file_is_missing_comparison_should_return_removed() { var root1 = FileSystemEntryBuilder.CreateRoot(@"C:\test"); root1.AddFile("file1.txt"); var root2 = FileSystemEntryBuilder.CreateRoot(@"C:\test"); var actual = root1.CompareTo(root2); Assert.AreEqual(2, actual.Count()); Assert.AreEqual(FileSystemEntryComparisonResult.Removed, actual.Last().Result); Assert.AreEqual(@"C:\test\file1.txt", actual.Last().ReferenceFileSystemEntry.Path); }
public void If_1_file_is_added_comparison_should_return_added() { var root1 = FileSystemEntryBuilder.CreateRoot(@"C:\test"); var root2 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddFile("file1.txt"); var actual = root1.CompareTo(root2).ToList(); var file1Comparison = actual.FirstOrDefault(f => f.CurrentFileSystemEntries.Single().Path == @"C:\test\file1.txt"); Assert.IsNotNull(file1Comparison); Assert.AreEqual(FileSystemEntryComparisonResult.Added, file1Comparison.Result); Assert.AreEqual(@"C:\test\file1.txt", file1Comparison.CurrentFileSystemEntries.Single().Path); }
public void If_1_directory_is_renamed_comparison_should_return_removed() { var root1 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddDirAndReturnParent("subfolder"); var root2 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddDirAndReturnChild("subfolderNew"); var actual = root1.CompareTo(root2); var subfolderComparison = actual.FirstOrDefault(f => f.ReferenceFileSystemEntry.Path == @"C:\test\subfolder"); Assert.IsNotNull(subfolderComparison); Assert.AreEqual(FileSystemEntryComparisonResult.Removed, subfolderComparison.Result); Assert.AreEqual(@"C:\test\subfolder", subfolderComparison.ReferenceFileSystemEntry.Path); }
public void If_1_directory_is_renamed_comparison_should_return_1_added_dir() { var root1 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddDirAndReturnParent("subfolder"); var root2 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddDirAndReturnChild("subfolderNew"); var actual = root1.CompareTo(root2); var subfolderNew = actual.FirstOrDefault(f => f.Result == FileSystemEntryComparisonResult.Added); Assert.IsNotNull(subfolderNew); Assert.AreEqual(FileSystemEntryComparisonResult.Added, subfolderNew.Result); Assert.AreEqual(@"C:\test\subfolderNew", subfolderNew.CurrentFileSystemEntries.Single().Path); }
public void If_1_file_is_moved_comparison_should_return_moved() { var root1 = FileSystemEntryBuilder.CreateRoot(@"C:\test"); root1.AddFile("file1.txt"); var root2 = FileSystemEntryBuilder.CreateRoot(@"C:\test") .AddDirAndReturnChild("subfolder") .AddFile("file1.txt"); var actual = root1.CompareTo(root2); var file1Comparison = actual.FirstOrDefault(f => f.ReferenceFileSystemEntry.Path == @"C:\test\file1.txt"); Assert.IsNotNull(file1Comparison); Assert.AreEqual(FileSystemEntryComparisonResult.Moved, file1Comparison.Result); Assert.AreEqual(@"C:\test\file1.txt", file1Comparison.ReferenceFileSystemEntry.Path); Assert.AreEqual(@"C:\test\subfolder\file1.txt", file1Comparison.CurrentFileSystemEntries.Single().Path); }