Example #1
0
        private bool StandardExecute(string gitDescribeReturnValue, out SemVerGitHarvester harvester)
        {
            var runner = this.CreateMockDescribeRunner(gitDescribeReturnValue);

            harvester             = new SemVerGitHarvester(runner);
            harvester.BuildEngine = this.CreateMockBuildEngine();
            harvester.GitPath     = SemVerGitHarvesterTests.GitPath;
            return(harvester.Execute());
        }
Example #2
0
        public void Execute_returns_false_if_git_path_is_not_set()
        {
            var runner = this.CreateMockDescribeRunner("v1.2.3-4-g1a2b3c4d");

            var harvester = new SemVerGitHarvester(runner);

            harvester.BuildEngine = this.CreateMockBuildEngine();
            var returnValue = harvester.Execute();

            Assert.AreEqual(false, returnValue);
        }
Example #3
0
        public void Execute_returns_false_if_git_describe_fails()
        {
            var mockRunner = new Mock <GitDescribeRunner>();

            mockRunner.Setup(r => r.Run(It.IsAny <string>())).Throws <Exception>();
            var runner = mockRunner.Object;

            var harvester = new SemVerGitHarvester(runner);

            harvester.BuildEngine = this.CreateMockBuildEngine();
            harvester.GitPath     = SemVerGitHarvesterTests.GitPath;
            var returnValue = harvester.Execute();

            Assert.AreEqual(false, returnValue);
        }
        public void Auto_detect_git_path()
        {
            var runner    = this.CreateMockDescribeRunner("v1.2.3-4-g1a2b3c4d");
            var harvester = new SemVerGitHarvester(runner);

            harvester.BuildEngine = this.CreateMockBuildEngine();
            harvester.GitPath     = null;

            var success = harvester.Execute();

            if (success)
            {
                Assert.True(File.Exists(harvester.GitPath));
            }
            else
            {
                Assert.True(harvester.GitPath == null);
            }
        }