public void QuestionMarkMatchesOneCharacter() { GlobPatternList pattern = new GlobPatternList(new List <string> { "foo?bar" }, new List <string> { }); Assert.Multiple(() => { Assert.That(pattern.Matches("foobar"), Is.False, "foobar"); Assert.That(pattern.Matches("foo_bar"), Is.True, "foo_bar"); Assert.That(pattern.Matches("Xfoo_bar"), Is.False, "Xfoo_bar"); }); }
public void AreNotEqualIfDifferent() { GlobPatternList pattern1 = new GlobPatternList(new List <string> { "foo*" }, new List <string> { "*bar" }); GlobPatternList pattern2 = new GlobPatternList(new List <string> { "baz*" }, new List <string> { "*fom" }); Assert.That(pattern1, Is.Not.EqualTo(pattern2)); }
public void AreEqualIfIdentical() { GlobPatternList pattern1 = new GlobPatternList(new List <string> { "foo*" }, new List <string> { "*bar" }); GlobPatternList pattern2 = new GlobPatternList(new List <string> { "foo*" }, new List <string> { "*bar" }); Assert.That(pattern1, Is.EqualTo(pattern2)); }
public void ExcludesTrumpIncludes() { GlobPatternList pattern = new GlobPatternList(new List <string> { "foo*" }, new List <string> { "*bar" }); Assert.Multiple(() => { Assert.That(pattern.Matches("foobar"), Is.False, "foobar"); Assert.That(pattern.Matches("foo_bar"), Is.False, "foo_bar"); Assert.That(pattern.Matches("foobarX"), Is.True, "foobarX"); }); }
public void StarMatchesAnyNumberOfCharacters() { GlobPatternList pattern = new GlobPatternList(new List <string> { "foo*bar" }, new List <string> { }); Assert.Multiple(() => { Assert.That(pattern.Matches("foobar"), Is.True, "foobar"); Assert.That(pattern.Matches("foo_bar"), Is.True, "foo_bar"); Assert.That(pattern.Matches("foobarbar"), Is.True, "foobarbar"); Assert.That(pattern.Matches("foofoobar"), Is.True, "foofoobar"); Assert.That(pattern.Matches("foobarX"), Is.False, "foobarX"); }); }
/// <summary> /// Applies the given uploader option section to this config object. /// </summary> public void ApplySection(ConfigParser.UploaderSubsection section) { VersionAssembly = section.VersionAssembly ?? VersionAssembly; Teamscale = section.Teamscale ?? Teamscale; Directory = section.Directory ?? Directory; AzureFileStorage = section.AzureFileStorage ?? AzureFileStorage; Enabled = section.Enabled ?? Enabled; VersionPrefix = section.VersionPrefix ?? VersionPrefix; PdbDirectory = section.PdbDirectory ?? PdbDirectory; RevisionFile = section.RevisionFile ?? RevisionFile; MergeLineCoverage = section.MergeLineCoverage ?? MergeLineCoverage; if (section.AssemblyPatterns != null) { // we ensure that something is always included by using "*" as the include if the user doesn't include anything List <string> includes = section.AssemblyPatterns.Include ?? DefaultAssemblyIncludePatterns; // unless the user explicitly overrides the excludes, we use the sane exclude patterns to prevent // the common error case of including System and other 3rd party assemblies. This prevents spamming the // logs with lots of useless errors/warnings both in the Uploader and in Teamscale List <string> excludes = section.AssemblyPatterns.Exclude ?? DefaultAssemblyExcludePatterns; AssemblyPatterns = new GlobPatternList(includes, excludes); } }