public void IgnoreDirectoryRegexTest1() { HashSet <string> ignoredFiles = new HashSet <string> { TestDirManager.Dir1_HelloHtml, TestDirManager.Dir1_HelloXml, TestDirManager.Dir2_MyDir_Myfile1Text, TestDirManager.Dir2_MyDir_Myfile2Text, TestDirManager.Dir2_MyfileTxt, TestDirManager.Dir2_Myfile2Txt, TestDirManager.Dir3_HiddenFile, TestDirManager.Dir3_HiddenHtml, }; HashSet <string> ignoredDirs = new HashSet <string> { TestDirManager.Dir1, TestDirManager.Dir2, TestDirManager.Dir2_MyDir, TestDirManager.Dir3 }; IgnoreConfig config = new IgnoreConfig(); config.AddDirNameToIgnore( @"dir\d", true ); foreach (string dir in TestDirManager.DirList) { if (ignoredDirs.Contains(dir)) { Assert.IsTrue(config.ShouldIgnore(dir), dir); } else { Assert.IsFalse(config.ShouldIgnore(dir), dir); } } foreach (string file in TestDirManager.FileList) { if (ignoredFiles.Contains(file)) { Assert.IsTrue(config.ShouldIgnore(file), file); } else { Assert.IsFalse(config.ShouldIgnore(file), file); } } }
public void IgnoreDirectoryRegexTest2() { IgnoreConfig config = new IgnoreConfig(); config.AddDirNameToIgnore( @"dir", true ); foreach (string dir in TestDirManager.DirList) { Assert.IsFalse(config.ShouldIgnore(dir), dir); } foreach (string file in TestDirManager.FileList) { Assert.IsFalse(config.ShouldIgnore(file), file); } }
public void IgnoreDirectoryRegexTest4() { HashSet <string> ignoredFiles = new HashSet <string> { TestDirManager.Dir2_MyDir_Myfile1Text, TestDirManager.Dir2_MyDir_Myfile2Text }; HashSet <string> ignoredDirs = new HashSet <string> { TestDirManager.Dir2_MyDir }; IgnoreConfig config = new IgnoreConfig(); config.AddDirNameToIgnore( @"mydir", true ); foreach (string dir in TestDirManager.DirList) { if (ignoredDirs.Contains(dir)) { Assert.IsTrue(config.ShouldIgnore(dir), dir); } else { Assert.IsFalse(config.ShouldIgnore(dir), dir); } } foreach (string file in TestDirManager.FileList) { if (ignoredFiles.Contains(file)) { Assert.IsTrue(config.ShouldIgnore(file), file); } else { Assert.IsFalse(config.ShouldIgnore(file), file); } } }