public void Clean_EmptyRootFolder_EmptyFileRegistry() { _folderNamesGenerator = path => Enumerable.Empty <string>(); _fileNamesGenerator = path => Enumerable.Empty <string>(); _cleaner.Clean("root"); _uniqueNames.Should().BeEmpty(); _backedUpNames.Should().BeEmpty(); }
public void CleanupTest() { var input = new List <ItemDescriptor> { new DirectoryDescriptor(@"D:\DIR\proj1", ".git"), new FileDescriptor(@"D:\DIR\proj2", "solution.sln"), new DirectoryDescriptor(@"D:\DIR\proj3", ".git"), new FileDescriptor(@"D:\DIR\proj3", "solution.sln"), new DirectoryDescriptor(@"D:\DIR\proj4", ".git"), new FileDescriptor(@"D:\DIR\proj4\subdir", "solution.sln"), }; var sut = new DuplicateCleaner(); var result = sut.Clean(input); var expected = new List <ItemDescriptor> { new DirectoryDescriptor(@"D:\DIR\proj1", ".git"), new FileDescriptor(@"D:\DIR\proj2", "solution.sln"), new FileDescriptor(@"D:\DIR\proj3", "solution.sln"), new DirectoryDescriptor(@"D:\DIR\proj4", ".git"), new FileDescriptor(@"D:\DIR\proj4\subdir", "solution.sln"), }; CollectionAssert.AreEqual(expected, result); }
public void Execute() { using (var backupManager = new BackupDirectoryManager(_rootFolder, _backupFolder)) { backupManager.CreateBackupDirectory(); var backedUpFileRegistry = new BackedUpFilesRegistry(backupManager); var folderNamesProvider = new DirectoryProvider(backupManager.BackupRoot); var cleaner = new DuplicateCleaner( new UniqueFilesRegistry(), backedUpFileRegistry, new FileProvider(), folderNamesProvider); cleaner.Clean(_rootFolder); } }