Exemplo n.º 1
0
        public void CommitFinder_FindCommitOnBranchToIgnore_SmokeTest()
        {
            var commitInfo = CommitFinder.FindCommitsOnBranchToIgnore(TestDataLocator.GetPath(), "release", new SearchOptions());

            Assert.AreEqual("3e8a6ddbef973d021ed13a48a9af2c306beef558", commitInfo.Item2);
            Assert.AreEqual(1, commitInfo.Item1.Count());
            Assert.AreEqual("7dfe9984e660d26829bbcbd29648348de9623221", commitInfo.Item1.First().Hash);
        }
Exemplo n.º 2
0
        public void CommitFinder_EndingOnlyRange_ReturnsCorrectEntires()
        {
            var range = new SearchRange();

            range.Newest = "261dab6".Some();
            var commits = CommitFinder.Parse(TestDataLocator.GetPath(), range);

            Assert.AreEqual(20, commits.Count());
        }
Exemplo n.º 3
0
        public void CommitFinder_ParseInvalidBranch_ReturnsEmpty()
        {
            var commits = CommitFinder.Parse(TestDataLocator.GetPath(), new SearchRange()
            {
                Oldest = "a-non-existant-branch".Some()
            });

            Assert.Zero(commits.Count());
        }
Exemplo n.º 4
0
        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());
            });
        }
Exemplo n.º 5
0
        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));
            });
        }
Exemplo n.º 6
0
        public void CommitParser_SmokeTestAllCommits()
        {
            var commits       = CommitFinder.Parse(TestDataLocator.GetPath(), new SearchRange());
            var parsedCommits = CommitParser.Parse(commits, new SearchOptions());

            Assert.NotZero(commits.Count());
            foreach (var parsedCommit in parsedCommits)
            {
                Assert.IsNotNull(parsedCommit.Commit.Title);
                Assert.IsNotNull(parsedCommit.Link);
            }
        }
Exemplo n.º 7
0
        public void CommitFinder_Parse_ReturnsEntries()
        {
            var commits = CommitFinder.Parse(TestDataLocator.GetPath(), new SearchRange());
            int count   = commits.Count();

            Assert.NotZero(commits.Count());
            foreach (var commit in commits)
            {
                Assert.IsNotNull(commit.Hash);
                Assert.IsNotNull(commit.Title);
                Assert.IsNotNull(commit.Description);
            }
        }
Exemplo n.º 8
0
        public void CommitFinder_StartingOnlyRange_ReturnsCorrectEntires()
        {
            // This is brittle if we add more tests data
            var range = new SearchRange();

            range.Oldest = "261dab6".Some();
            var commits = CommitFinder.Parse(TestDataLocator.GetPath(), range);

            Assert.AreEqual(27, commits.Count());

            range.IncludeOldest = false;
            commits             = CommitFinder.Parse(TestDataLocator.GetPath(), range);
            Assert.AreEqual(26, commits.Count());
        }
Exemplo n.º 9
0
        public void CommitFinder_SubsetRange_ReturnsCorrectEntires()
        {
            var range = new SearchRange();

            range.Oldest = "4bb85fb".Some();
            range.Newest = "261dab6".Some();
            var commits = CommitFinder.Parse(TestDataLocator.GetPath(), range);

            Assert.AreEqual(6, commits.Count());

            range.IncludeOldest = false;
            commits             = CommitFinder.Parse(TestDataLocator.GetPath(), range);
            Assert.AreEqual(5, commits.Count());
        }
Exemplo n.º 10
0
        public void BugCollector_SmokeTest()
        {
            var options = new SearchOptions()
            {
                Bugzilla = BugzillaLevel.Private
            };
            var range = new SearchRange {
                Oldest = "98fff31".Some(), Newest = "6c280ad".Some()
            };
            var commits       = CommitFinder.Parse(TestDataLocator.GetPath(), range);
            var parsedCommits = CommitParser.Parse(commits, options).ToList();

            var bugCollection = BugCollector.ClassifyCommits(parsedCommits, options);

            Assert.AreEqual(2, bugCollection.Bugs.Count);
            Assert.AreEqual(3, bugCollection.PotentialBugs.Count);
        }
Exemplo n.º 11
0
        public void BugCollector_HandlesDuplicateBugEntries()
        {
            // One commit with certain, one without. Only one copy in final output
            var options = new SearchOptions()
            {
                Bugzilla = BugzillaLevel.Private
            };
            var range = new SearchRange {
                Oldest = "ad26139".Some(), Newest = "6c280ad".Some()
            };
            var commits       = CommitFinder.Parse(TestDataLocator.GetPath(), range);
            var parsedCommits = CommitParser.Parse(commits, options).ToList();

            var bugCollection = BugCollector.ClassifyCommits(parsedCommits, new SearchOptions());

            Assert.AreEqual(1, bugCollection.Bugs.Count);
            Assert.AreEqual(0, bugCollection.PotentialBugs.Count);
        }
Exemplo n.º 12
0
        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}");
            });
        }
Exemplo n.º 13
0
        public void CommitFinder_ParseInvalidHash_ReturnsEmpty()
        {
            var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), "NOT_A_HASH");

            Assert.IsFalse(commit.HasValue);
        }
Exemplo n.º 14
0
        public void CommitFinder_ParseSingle_ReturnsEntry()
        {
            var commit = CommitFinder.ParseSingle(TestDataLocator.GetPath(), "98fff3172956031c4443574d0f6c9d1e204893ae");

            Assert.IsTrue(commit.HasValue);
        }
Exemplo n.º 15
0
        public void CommitFinder_ParseInvalidPath_ReturnsEmpty()
        {
            var commits = CommitFinder.Parse("/not/a/path", new SearchRange());

            Assert.Zero(commits.Count());
        }
Exemplo n.º 16
0
        public void CommitFinder_FindMergeBase_SmokeTest()
        {
            var mergeBase = CommitFinder.FindMergeBase(TestDataLocator.GetPath(), "release");

            Assert.AreEqual("3e8a6ddbef973d021ed13a48a9af2c306beef558", mergeBase.ValueOrFailure());
        }