public void TestExcludedFiles() { var testDirectoryPath = Path.Combine(testFolder, "TestExcludedFiles"); var exludedFiles = new string[] { Path.Combine(testDirectoryPath, ".test.txt"), Path.Combine(testDirectoryPath, "#test.txt"), Path.Combine(testDirectoryPath, "~autorecover.test.txt"), Path.Combine(testDirectoryPath, "~test.txt"), }; Directory.CreateDirectory(testDirectoryPath); foreach (var filePath in exludedFiles) { File.Create(filePath).Close(); } var archive = new LastModifiedArchive(monitorFolder); using (var monitor = new DirectoryScanningMonitor(monitorFolder, archive)) { monitor.AddDirectory(testDirectoryPath); Assert.AreEqual(0, monitor.GetFilesFromSource().Count); } }
public void TestExcludedDirectory() { var testExcludedDirectoryPath = Path.Combine(testFolder, "TestExcludedDirectory"); var excludedFolders = new string[] { Path.Combine(testExcludedDirectoryPath, "TestResults"), Path.Combine(testExcludedDirectoryPath, "Backup"), Path.Combine(testExcludedDirectoryPath, "Backup1"), Path.Combine(testExcludedDirectoryPath, "backup111"), Path.Combine(testExcludedDirectoryPath, ".test") }; foreach (var folder in excludedFolders) { Directory.CreateDirectory(folder); File.Create(Path.Combine(folder, "test.txt")).Close(); } var archive = new LastModifiedArchive(monitorFolder); using (var monitor = new DirectoryScanningMonitor(monitorFolder, archive)) { monitor.AddDirectory(testExcludedDirectoryPath); Assert.AreEqual(0, monitor.GetFilesFromSource().Count); } }