Esempio n. 1
0
        public void when_tag_has_no_commits_on_top_then_commits_output_is_zero()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                Tag = "v1.0.2",
            };

            task.Execute();

            Assert.Equal("0", task.Commits);
        }
Esempio n. 2
0
        public void when_tag_has_no_commits_on_top_then_commits_output_is_zero()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                Tag         = "v1.0.2",
            };

            task.Execute();

            Assert.Equal("0", task.Commits);
        }
Esempio n. 3
0
        public void when_non_semantic_tag_then_fails_and_logs()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                Tag = "Beta1",
            };

            Assert.False(task.Execute());

            Mock.Get(task.BuildEngine).Verify(x => x.LogErrorEvent(It.IsAny<BuildErrorEventArgs>()));
        }
Esempio n. 4
0
        public void when_non_semantic_tag_then_fails_and_logs()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                Tag         = "Beta1",
            };

            Assert.False(task.Execute());

            Mock.Get(task.BuildEngine).Verify(x => x.LogErrorEvent(It.IsAny <BuildErrorEventArgs>()));
        }
Esempio n. 5
0
        public void when_tag_has_prerelease_but_no_commits_on_top_then_patch_matches_tag()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-pre",
            };

            task.Execute();

            Assert.Equal("2", task.Patch);
        }
Esempio n. 6
0
        public void when_tag_has_commits_then_commits_output_equals_label_commits()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-6-g778787d",
            };

            task.Execute();

            Assert.Equal("6", task.Commits);
        }
Esempio n. 7
0
        public void when_tag_has_commits_then_adds_them_to_patch()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-6-g778787d",
            };

            task.Execute();

            Assert.Equal("8", task.Patch);
        }
Esempio n. 8
0
        public void when_tag_has_prerelease_prefix_then_parses_it()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-pre-6-g778787d",
            };

            task.Execute();

            Assert.Equal("-pre", task.PreRelease);
        }
Esempio n. 9
0
        public void when_tag_has_commits_then_commits_output_equals_label_commits()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-6-g778787d",
            };

            task.Execute();

            Assert.Equal("6", task.Commits);
        }
Esempio n. 10
0
        public void when_tag_has_commits_then_adds_them_to_patch()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-6-g778787d",
            };

            task.Execute();

            Assert.Equal("8", task.Patch);
        }
Esempio n. 11
0
        public void when_tag_has_prerelease_but_no_commits_on_top_then_patch_matches_tag()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-pre",
            };

            task.Execute();

            Assert.Equal("2", task.Patch);
        }
Esempio n. 12
0
        public void when_tag_has_prerelease_prefix_then_parses_it2()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v3.9.0-preview-32-g87331c5",
            };

            task.Execute();

            Assert.Equal("-preview", task.PreRelease);
            Assert.Equal("32", task.Patch);
        }
Esempio n. 13
0
        public void when_tag_is_semantic_then_parses_major_minor_patch()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of <IBuildEngine>(),
                Tag         = "v1.0.2",
            };

            task.Execute();

            Assert.Equal("1", task.Major);
            Assert.Equal("0", task.Minor);
            Assert.Equal("2", task.Patch);
        }
Esempio n. 14
0
        public void when_tag_has_prerelease_prefix_then_parses_it()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v1.0.2-pre-6-g778787d",
            };

            task.Execute();

            Assert.Equal("-pre", task.PreRelease);
        }
Esempio n. 15
0
        public void when_tag_is_semantic_then_parses_major_minor_patch()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                Tag = "v1.0.2",
            };

            task.Execute();

            Assert.Equal("1", task.Major);
            Assert.Equal("0", task.Minor);
            Assert.Equal("2", task.Patch);
        }
Esempio n. 16
0
        public void when_tag_has_prerelease_prefix_then_parses_it2()
        {
            var task = new GetSemanticVersion
            {
                BuildEngine = Mock.Of<IBuildEngine>(),
                // This is the format that git describe --tags renders.
                Tag = "v3.9.0-preview-32-g87331c5",
            };

            task.Execute();

            Assert.Equal("-preview", task.PreRelease);
            Assert.Equal("32", task.Patch);
        }