public void CanTakeVersionFromNameOfReleaseBranch(string branchName, string expectedBaseVersion)
        {
            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit();
            var branch = fixture.Repository.CreateBranch(branchName);

            var gitVersionContext = new GitVersionContext(fixture.Repository, log, branch, configuration);
            var baseVersion       = strategy.GetVersions(gitVersionContext).Single();

            baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion);
        }
Beispiel #2
0
        public void ShouldNotBeIncremented()
        {
            var gitVersionContext = contextBuilder
                                    .WithConfig(new Config
            {
                NextVersion = "1.0.0"
            }).Build();

            var baseVersion = strategy.GetVersions(gitVersionContext).Single();

            baseVersion.ShouldIncrement.ShouldBe(false);
            baseVersion.SemanticVersion.ToString().ShouldBe("1.0.0");
        }
    private IEnumerable <BaseVersion> GetBaseVersions(IVersionStrategy strategy)
    {
        foreach (var version in strategy.GetVersions())
        {
            if (version == null)
            {
                continue;
            }

            this.log.Info(version.ToString());
            if (strategy is FallbackVersionStrategy || IncludeVersion(version))
            {
                yield return(version);
            }
        }
    }