public void ProcessDirectory_of_InValid_Path_without_Subdirectories_Does_Not_Add_Path() { string targetDirectory = @"C:\Foo\Bar"; IValidateFolder validator = Substitute.For <IValidateFolder>(); validator.IsValidFolder(targetDirectory).Returns(true); IProcessFolder processor = new FolderList(validator); FolderList processorResult = (FolderList)RecursiveFolderProcessor.ProcessDirectory(targetDirectory, processor, includeSubDirectories: false); Assert.AreEqual(0, processorResult.Paths.Count); }
public void ProcessDirectory_of_Valid_Path_without_Subdirectories_Adds_Path() { string targetDirectory = Path.GetFullPath(Path.Combine(_assemblyFolder, @"..\")); IValidateFolder validator = Substitute.For <IValidateFolder>(); validator.IsValidFolder(_assemblyFolder).Returns(true); IProcessFolder processor = new FolderList(validator); FolderList processorResult = (FolderList)RecursiveFolderProcessor.ProcessDirectory(targetDirectory, processor, includeSubDirectories: false); Assert.AreEqual(1, processorResult.Paths.Count); Assert.AreEqual(processorResult.Paths[0], _assemblyFolder); }
public void ProcessDirectory_of_InValid_Path_without_Subdirectories_Events_Messenger() { string targetDirectory = @"C:\Foo\Bar"; IValidateFolder validator = Substitute.For <IValidateFolder>(); validator.IsValidFolder(targetDirectory).Returns(true); IProcessFolder processor = new FolderList(validator); var wasCalled = false; RecursiveFolderProcessor.Messenger += (e) => wasCalled = true; RecursiveFolderProcessor.ProcessDirectory(targetDirectory, processor, includeSubDirectories: false); Assert.IsTrue(wasCalled); }