void TestCommitHasNoBug(string hash, Option <SearchOptions> options) { var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), hash); Assert.True(commit.HasValue); commit.MatchSome(c => { var parsedCommits = CommitParser.ParseSingle(c, options.ValueOr(new SearchOptions())); Assert.Zero(parsedCommits.Count()); }); }
void TestMultipleCommits(string hash, List <string> expectedUrls, Option <SearchOptions> options) { var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), hash); Assert.IsTrue(commit.HasValue); commit.MatchSome(c => { var parsedCommits = CommitParser.ParseSingle(c, options.ValueOr(new SearchOptions())).ToList(); Assert.AreEqual(parsedCommits.Count(), expectedUrls.Count); Assert.True(new HashSet <string> (parsedCommits.Select(x => x.Link)).SetEquals(expectedUrls)); }); }
void TestConfidenceOfCommit(string hash, string expectedUrl, ParsingConfidence expectedConfidence, Option <SearchOptions> options) { var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), hash); Assert.IsTrue(commit.HasValue); commit.MatchSome(c => { var parsedCommits = CommitParser.ParseSingle(c, options.ValueOr(new SearchOptions() { Bugzilla = BugzillaLevel.Private })); Assert.AreEqual(1, parsedCommits.Count(), $"{hash} did not parse into one bug commit"); var parsedCommit = parsedCommits.First(); Assert.AreEqual(expectedUrl, parsedCommit.Link, $"{hash} link {parsedCommit.Link} did not match expected {expectedUrl}"); Assert.AreEqual(expectedConfidence, parsedCommit.Confidence, $"{hash} confidence {parsedCommit.Confidence} did not match expected {expectedConfidence}"); }); }