public void ShouldBeIncluded(string pathTemplate) { var path = pathTemplate.Replace("{sep}", $"{Path.DirectorySeparatorChar}"); var actual = DirectoryExclusions.PathIsExcluded(path); Assert.That(actual, Is.False); }
public void ShouldBeExcluded(string pathTemplate) { var path = pathTemplate.Replace("{sep}", $"{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase); var actual = DirectoryExclusions.PathIsExcluded(path); Assert.That(actual, Is.True); }
public void ShouldBeExcluded(string pathTemplate) { if (string.IsNullOrWhiteSpace(pathTemplate)) { throw new ArgumentNullException(nameof(pathTemplate)); } string path = ExpandTemplate(pathTemplate); var exclusions = new DirectoryExclusions(); var actual = exclusions.PathIsExcluded(path); Assert.That(actual, Is.True); }
bool IncludeDirectory(string directoryPath) { Guard.DirectoryExists(directoryPath, nameof(directoryPath)); var suffix = Path.GetFileName(directoryPath); if (suffix.StartsWith(".")) { return(false); } if (DirectoryExclusions.ShouldExcludeDirectory(suffix)) { return(false); } if (directoryFilter == null) { return(true); } return(directoryFilter(directoryPath)); }