public void TestFiltersFilesFromDirectory() { var monitor = new DirectoryMonitor(DirectoryName, "*.csv"); var fileNames = monitor.GetUnprocessedFileNames().OrderBy(s => s).ToList(); Assert.AreEqual <int>(fileNames.Count, 1); Assert.AreEqual <string>(fileNames[0], TestFileName2); }
public void SeesOnlyNewFiles() { var monitor = new DirectoryMonitor(DirectoryName); monitor.MarkFileNameAsProcessed(TestFileName1); monitor.MarkFileNameAsInvalid(TestFileName2); var fileNames = monitor.GetUnprocessedFileNames().OrderBy(s => s).ToList(); Assert.AreEqual <int>(fileNames.Count, 0); var fs3 = File.Create(TestFileName3); fs3.Close(); fileNames = monitor.GetUnprocessedFileNames().OrderBy(s => s).ToList(); Assert.AreEqual <int>(fileNames.Count, 1); Assert.AreEqual <string>(fileNames[0], TestFileName3); }
public void TestSeeFilesInDirectory() { var monitor = new DirectoryMonitor(DirectoryName); var fileNames = monitor.GetUnprocessedFileNames().OrderBy(s => s).ToList(); Assert.AreEqual <int>(fileNames.Count, 2); Assert.AreEqual <string>(fileNames[0], TestFileName1); Assert.AreEqual <string>(fileNames[1], TestFileName2); }
public void TestDoesNotSeeInvalidFiles() { var monitor = new DirectoryMonitor(DirectoryName); monitor.MarkFileNameAsInvalid(TestFileName1); var fileNames = monitor.GetUnprocessedFileNames().OrderBy(s => s).ToList(); Assert.AreEqual <int>(fileNames.Count, 1); Assert.AreEqual <string>(fileNames[0], TestFileName2); }