Example #1
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);
            }
        }
Example #2
0
        /// <summary>
        ///     Get the next applicable version of the project.
        /// </summary>
        /// <param name="repository">Repository of the project.</param>
        /// <returns>A <see cref="ProjectVersion"/> representing the next version.</returns>
        public ProjectVersion GetNextVersion(Repository repository)
        {
            var versionTag = repository.GetVersionTag(Version);
            var commits    = repository.GetCommitsSinceLastVersion(versionTag);

            var isMaster = repository.Head.FriendlyName == "master";

            Commits = CommitParser.Parse(commits);
            var incrementStrategy = VersionIncrementStrategy.Create(Commits, isMaster);

            return(incrementStrategy.NextVersion(Version));
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
0
        public void Parse_CommitOnBranch2_ReturnsOneCommitOnBranch2()
        {
            // Assemble
            dynamic push     = ParseFromFile("CommitOnBranch2.json");
            var     expected = new List <Commit>
            {
                new Commit
                {
                    Branch    = "branch2",
                    CardId    = null,
                    Message   = "sample commit message",
                    CommitUrl = @"https://github.com/jquintus/spikes/commit/629b493f34631ddc43f71421a35b2688619647c8",
                }
            };

            // Act
            var actual = _parser.Parse(push);

            // Assemble
            CollectionAssert.AreEqual(expected, actual);
        }