public void DuplicateFileFinderWithNoDuplicatesReturnsSuccess() { Mock <IFileHashProvider> fileHashMock = new Mock <IFileHashProvider>(); var fileList = new List <FileInfoWithHash>(); fileList.Add(new FileInfoWithHash("test1", "test1")); fileList.Add(new FileInfoWithHash("test2", "test2")); Mock <IFileRepository> fileRepositoryMock = new Mock <IFileRepository>(); fileRepositoryMock.Setup(m => m.GetFiles(It.IsAny <string>())) .Returns(fileList); IDuplicateFileFinder duplicateFileFinder = new DuplicateFileFinder(fileRepositoryMock.Object); var duplicates = duplicateFileFinder.FindDuplicates(@".\"); Assert.IsTrue(duplicates.Count == 0); }
private static async Task FindDups(string sourcepath) { var dff = new DuplicateFileFinder( null, new Directory(sourcepath) ); dff.OnFileReadError += DffOnOnFileReadError; dff.OnPlannedDelete += DffOnOnPlannedDelete; dff.OnDuplicateFound += dff_OnDuplicateFound; dff.OnHashProgress += dff_OnHashProgress; await dff.FindDuplicates(); LogDups(); }
public DuplicateViewModel() { Bc = new BitMapCreator(); if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { var dff = new DuplicateFileFinder( null, new Directory(@"C:\Users\Kevin\OneDrive\duptest")); dff.FindDuplicates(); FileMapByString fm = dff._duplicates; foreach (var item in fm) { foreach (IFile file in item.Value) { dff_OnDuplicateFound(item.Key, file.Path, file.GetSize()); } } } }
public void DuplicateFileFinderWithEmptyStringFileRepositoryError() { IDuplicateFileFinder duplicateFileFinder = new DuplicateFileFinder(null); duplicateFileFinder.FindDuplicates(string.Empty); }