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}"); }); }
public void CommitFinder_ParseInvalidHash_ReturnsEmpty() { var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), "NOT_A_HASH"); Assert.IsFalse(commit.HasValue); }
public void CommitFinder_ParseSingle_ReturnsEntry() { var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), "98fff3172956031c4443574d0f6c9d1e204893ae"); Assert.IsTrue(commit.HasValue); }