Example #1
0
    public void GitFlowPullRequestBranch()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.SequenceDiagram.Participant("master");
            fixture.SequenceDiagram.Participant("develop");

            // GitFlow setup
            fixture.Repository.MakeACommit();
            fixture.ApplyTag("1.2.0");
            fixture.BranchTo("develop");

            // Branch to develop
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-alpha.1");

            // Open Pull Request
            fixture.BranchTo("pull/2/merge", "pr");
            fixture.SequenceDiagram.Activate("pull/2/merge");
            fixture.AssertFullSemver("1.3.0-PullRequest0002.1");
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-PullRequest0002.2");

            // Merge into develop
            fixture.Checkout("develop");
            fixture.MergeNoFF("pull/2/merge");
            fixture.SequenceDiagram.Destroy("pull/2/merge");
            fixture.SequenceDiagram.NoteOver("Feature branches/pr's should\r\n" +
                             "be deleted once merged", "pull/2/merge");
            fixture.AssertFullSemver("1.3.0-alpha.3");
            Console.WriteLine(fixture.SequenceDiagram.GetDiagram());
        }
    }
Example #2
0
    string RepositoryScope(ExecuteCore executeCore = null, Action<EmptyRepositoryFixture, VersionVariables> fixtureAction = null)
    {
        // Make sure GitVersion doesn't trigger build server mode when we are running the tests
        Environment.SetEnvironmentVariable("APPVEYOR", null);
        var infoBuilder = new StringBuilder();
        Action<string> infoLogger = s => { infoBuilder.AppendLine(s); };
        executeCore = executeCore ?? new ExecuteCore(fileSystem);

        Logger.SetLoggers(infoLogger, s => { }, s => { });

        using (var fixture = new EmptyRepositoryFixture(new Config()))
        {
            fixture.Repository.MakeACommit();
            var vv = executeCore.ExecuteGitVersion(null, null, null, null, false, fixture.RepositoryPath, null);

            vv.AssemblySemVer.ShouldBe("0.1.0.0");
            vv.FileName.ShouldNotBeNullOrEmpty();

            if (fixtureAction != null)
            {
                fixtureAction(fixture, vv);
            }
        }

        return infoBuilder.ToString();
    }
    public void GitFlowHotfixBranch()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.SequenceDiagram.Participant("develop");
            fixture.SequenceDiagram.Participant("master");

            fixture.Repository.MakeACommit();
            fixture.ApplyTag("1.2.0");

            // Create hotfix branch
            fixture.Checkout("master");
            fixture.BranchTo("hotfix/1.2.1", "hotfix");
            fixture.SequenceDiagram.Activate("hotfix/1.2.1");
            fixture.MakeACommit();
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.2.1-beta.1+2");

            // Apply beta.1 tag should be exact tag
            fixture.ApplyTag("1.2.1-beta.1");
            fixture.AssertFullSemver("1.2.1-beta.1");
            fixture.Checkout("master");
            fixture.MergeNoFF("hotfix/1.2.1");
            fixture.SequenceDiagram.Destroy("hotfix/1.2.1");
            fixture.SequenceDiagram.NoteOver("Hotfix branches are deleted once merged", "hotfix/1.2.1");
            fixture.ApplyTag("1.2.1");
        }
    }
        public void NormalisationOfTag()
        {
            using (var fixture = new EmptyRepositoryFixture())
            {
                fixture.Repository.MakeACommit();

                fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
                fixture.Repository.MakeACommit();

                fixture.BranchTo("release/2.0.0");
                fixture.MakeACommit();
                fixture.MakeATaggedCommit("2.0.0-rc.1");
                fixture.Checkout("master");
                fixture.MergeNoFF("release/2.0.0");
                fixture.Repository.Branches.Remove(fixture.Repository.Branches["release/2.0.0"]);
                var remoteTagSha = fixture.Repository.Tags["2.0.0-rc.1"].Target.Sha;

                using (var localFixture = fixture.CloneRepository())
                {
                    localFixture.Checkout(remoteTagSha);
                    GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: string.Empty);

                    localFixture.Repository.Head.FriendlyName.ShouldBe("(no branch)");
                    localFixture.Repository.Head.Tip.Sha.ShouldBe(remoteTagSha);
                }
            }
        }
Example #5
0
    public void WhenMergingReleaseBackToDevShouldNotResetBetaVersion()
    {
        using (var fixture = new EmptyRepositoryFixture(new Config()))
        {
            const string TaggedVersion = "1.0.3";
            fixture.Repository.MakeATaggedCommit(TaggedVersion);
            fixture.Repository.CreateBranch("develop");
            fixture.Repository.Checkout("develop");

            fixture.Repository.MakeCommits(1);

            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Repository.Checkout("release-2.0.0");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("2.0.0-beta.1+1");

            //tag it to bump to beta 2
            fixture.Repository.ApplyTag("2.0.0-beta1");

            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("2.0.0-beta.2+0");

            //merge down to develop
            fixture.Repository.Checkout("develop");
            fixture.Repository.MergeNoFF("release-2.0.0", Constants.SignatureNow());

            //but keep working on the release
            fixture.Repository.Checkout("release-2.0.0");

            fixture.AssertFullSemver("2.0.0-beta.2+0");
        }
    }
Example #6
0
        public void NormalisationOfTag()
        {
            using (var fixture = new EmptyRepositoryFixture(new Config()))
            {
                fixture.Repository.MakeACommit();

                fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
                fixture.Repository.MakeACommit();

                fixture.BranchTo("release/2.0.0");
                fixture.MakeACommit();
                fixture.MakeATaggedCommit("2.0.0-rc.1");
                fixture.Checkout("master");
                fixture.MergeNoFF("release/2.0.0");
                fixture.Repository.Branches.Remove(fixture.Repository.FindBranch("release/2.0.0"));
                var remoteTagSha = fixture.Repository.Tags["2.0.0-rc.1"].Target.Sha;
                
                using (var localFixture = fixture.CloneRepository())
                {
                    localFixture.Checkout(remoteTagSha);
                    GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: string.Empty);

                    localFixture.AssertFullSemver("2.0.0-rc.1");
                }
            }
        }
    public void UsesGitVersionConfigWhenCreatingDynamicRepository()
    {
        var localRepoPath = PathHelper.GetTempPath();
        var repoBasePath = Path.GetDirectoryName(PathHelper.GetTempPath());
        Directory.CreateDirectory(localRepoPath);

        try
        {
            using (var remote = new EmptyRepositoryFixture(new Config()))
            {
                remote.Repository.MakeACommit();
                var configFile = Path.Combine(localRepoPath, "GitVersionConfig.yaml");
                File.WriteAllText(configFile, "next-version: 1.0.0");

                var arguments = string.Format(" /url {0} /dynamicRepoLocation {1} /b master", remote.RepositoryPath, repoBasePath);
                var results = GitVersionHelper.ExecuteIn(localRepoPath, arguments, false);
                results.OutputVariables.SemVer.ShouldBe("1.0.0");
            }
        }
        finally
        {
            DeleteHelper.DeleteGitRepository(localRepoPath);
            DeleteHelper.DeleteGitRepository(repoBasePath);
        }
    }
    public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly()
    {
        var config = new Config();
        config.Branches.Add("unstable", config.Branches["develop"]);

        using (var fixture = new EmptyRepositoryFixture(config))
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            fixture.Repository.CreateBranch("unstable");
            fixture.Repository.Checkout("unstable");

            //Create an initial feature branch
            var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
            fixture.Repository.Checkout("feature/JIRA-123");
            fixture.Repository.MakeCommits(1);

            //Merge it
            fixture.Repository.Checkout("unstable");
            fixture.Repository.Merge(feature123, SignatureBuilder.SignatureNow());

            //Create a second feature branch
            fixture.Repository.CreateBranch("feature/JIRA-124");
            fixture.Repository.Checkout("feature/JIRA-124");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
        }
    }
    public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly()
    {
        var config = new Config
        {
            Branches =
            {
                { "unstable", new BranchConfig { Increment = IncrementStrategy.Minor } }
            }
        };

        using (var fixture = new EmptyRepositoryFixture(config))
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            fixture.Repository.CreateBranch("unstable");
            fixture.Repository.Checkout("unstable");

            //Create an initial feature branch
            var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
            fixture.Repository.Checkout("feature/JIRA-123");
            fixture.Repository.MakeCommits(1);

            //Merge it
            fixture.Repository.Checkout("unstable");
            fixture.Repository.Merge(feature123, Constants.SignatureNow());

            //Create a second feature branch
            fixture.Repository.CreateBranch("feature/JIRA-124");
            fixture.Repository.Checkout("feature/JIRA-124");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
        }
    }
    public void GitFlowPullRequestBranch()
    {
        using (var fixture = new EmptyRepositoryFixture(new Config()))
        {
            fixture.Participant("master");
            fixture.Participant("develop");

            // GitFlow setup
            fixture.Repository.MakeACommit();
            fixture.ApplyTag("1.2.0");
            fixture.BranchTo("develop");

            // Branch to develop
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-unstable.1");

            // Open Pull Request
            fixture.BranchTo("pull/2/merge", "pr");
            fixture.Activate("pull/2/merge");
            fixture.AssertFullSemver("1.3.0-PullRequest.2+1");
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-PullRequest.2+2");

            // Merge into develop
            fixture.Checkout("develop");
            fixture.MergeNoFF("pull/2/merge");
            fixture.Destroy("pull/2/merge");
            fixture.NoteOver("Feature branches/pr's should\r\n" +
                             "be deleted once merged", "pull/2/merge");
            fixture.AssertFullSemver("1.3.0-unstable.3");
        }
    }
    public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch()
    {
        using (var fixture = new EmptyRepositoryFixture(new Config()))
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            fixture.Repository.CreateBranch("development");
            fixture.Repository.Checkout("development");

            //Create an initial feature branch
            var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
            fixture.Repository.Checkout("feature/JIRA-123");
            fixture.Repository.MakeCommits(1);

            //Merge it
            fixture.Repository.Checkout("development");
            fixture.Repository.Merge(feature123, Constants.SignatureNow());

            //Create a second feature branch
            fixture.Repository.CreateBranch("feature/JIRA-124");
            fixture.Repository.Checkout("feature/JIRA-124");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
        }
    }
    public void NoMergeBacksToDevelopInCaseThereAreChangesInReleaseBranch()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeACommit();
            fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
            fixture.Repository.MakeCommits(3);
            var releaseBranch = fixture.Repository.CreateBranch("release/1.0.0");
            fixture.Repository.Checkout(releaseBranch);
            fixture.Repository.MakeACommit();

            // Merge to master
            fixture.Repository.Checkout("master");
            fixture.Repository.MergeNoFF("release/1.0.0");
            fixture.Repository.ApplyTag("1.0.0");

            // Merge to develop
            fixture.Repository.Checkout("develop");
            fixture.Repository.MergeNoFF("release/1.0.0");
            fixture.AssertFullSemver("1.1.0-alpha.2");

            fixture.Repository.MakeACommit();
            fixture.Repository.Branches.Remove(releaseBranch);

            fixture.AssertFullSemver("1.1.0-alpha.2");
        }
    }
Example #13
0
        public void UpdatesCurrentBranch()
        {
            using (var fixture = new EmptyRepositoryFixture(new Config()))
            {
                fixture.Repository.MakeACommit();
                fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
                fixture.Repository.MakeACommit();
                fixture.Repository.Checkout("master");
                using (var localFixture = fixture.CloneRepository())
                {
                    // Advance remote
                    fixture.Repository.Checkout("develop");
                    var advancedCommit = fixture.Repository.MakeACommit();
                    localFixture.Repository.Network.Fetch(localFixture.Repository.Network.Remotes["origin"]);
                    localFixture.Repository.Checkout(advancedCommit.Sha);
                    localFixture.Repository.DumpGraph();
                    GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: "ref/heads/develop");

                    var normalisedBranch = localFixture.Repository.FindBranch("develop");
                    normalisedBranch.ShouldNotBe(null);
                    fixture.Repository.DumpGraph();
                    localFixture.Repository.DumpGraph();
                    normalisedBranch.Tip.Sha.ShouldBe(advancedCommit.Sha);
                    localFixture.Repository.Head.Tip.Sha.ShouldBe(advancedCommit.Sha);
                }
            }
        }
    public void GitFlowFeatureBranch()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.SequenceDiagram.Participant("master");
            fixture.SequenceDiagram.Participant("develop");

            // GitFlow setup
            fixture.Repository.MakeACommit();
            fixture.ApplyTag("1.2.0");
            fixture.BranchTo("develop");

            // Branch to develop
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-unstable.1");

            // Open Pull Request
            fixture.BranchTo("feature/myfeature", "feature");
            fixture.SequenceDiagram.Activate("feature/myfeature");
            fixture.AssertFullSemver("1.3.0-myfeature.1+1");
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.3.0-myfeature.1+2");

            // Merge into develop
            fixture.Checkout("develop");
            fixture.MergeNoFF("feature/myfeature");
            fixture.SequenceDiagram.Destroy("feature/myfeature");
            fixture.SequenceDiagram.NoteOver("Feature branches should\r\n" +
                             "be deleted once merged", "feature/myfeature");
            fixture.AssertFullSemver("1.3.0-unstable.3");
        }
    }
    public void ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMasterAreEqual()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeATaggedCommit("v1.0.0");

            fixture.Repository.CreateBranch("develop");
            fixture.Repository.Checkout("develop");

            fixture.Repository.CreateBranch("feature/longrunning");
            fixture.Repository.Checkout("feature/longrunning");
            fixture.Repository.MakeACommit();

            fixture.Repository.Checkout("develop");
            fixture.Repository.MakeACommit();

            fixture.Repository.Checkout("master");
            fixture.Repository.Merge(fixture.Repository.Branches["develop"], Generate.SignatureNow());
            fixture.Repository.ApplyTag("v1.1.0");

            fixture.Repository.Checkout("feature/longrunning");
            fixture.Repository.Merge(fixture.Repository.Branches["develop"], Generate.SignatureNow());

            var configuration = new Config { VersioningMode = VersioningMode.ContinuousDeployment };
            fixture.AssertFullSemver(configuration, "1.2.0-longrunning.2");
        }
    }
Example #16
0
    public void MinorReleaseExample()
    {
        using (var fixture = new EmptyRepositoryFixture(new Config()))
        {
            fixture.Repository.MakeATaggedCommit("1.2.0");

            // Branch to develop
            fixture.Repository.CreateBranch("develop").Checkout();
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver("1.3.0-unstable.1");

            // Open Pull Request
            fixture.Repository.CreateBranch("pull/2/merge").Checkout();
            fixture.AssertFullSemver("1.3.0-PullRequest.2+1");
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver("1.3.0-PullRequest.2+2");

            // Merge into develop
            fixture.Repository.Checkout("develop");
            fixture.Repository.MergeNoFF("pull/2/merge", Constants.SignatureNow());
            fixture.AssertFullSemver("1.3.0-unstable.3");

            // Create release branch
            fixture.Repository.CreateBranch("release-1.3.0").Checkout();
            fixture.AssertFullSemver("1.3.0-beta.1+0");

            // Make another commit on develop
            fixture.Repository.Checkout("develop");
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver("1.3.0-unstable.4");

            // Make a commit to release-1.3.0
            fixture.Repository.Checkout("release-1.3.0");
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver("1.3.0-beta.1+1");

            // Apply beta.1 tag should be exact tag
            fixture.Repository.ApplyTag("1.3.0-beta.1");
            fixture.AssertFullSemver("1.3.0-beta.1");

            // Make a commit after a tag should bump up the beta
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver("1.3.0-beta.2+2");

            // Merge release branch to master
            fixture.Repository.Checkout("master");
            fixture.Repository.MergeNoFF("release-1.3.0", Constants.SignatureNow());
            fixture.AssertFullSemver("1.3.0+0");
            fixture.Repository.ApplyTag("1.3.0");

            // Verify develop version
            fixture.Repository.Checkout("develop");
            fixture.AssertFullSemver("1.3.0-unstable.4");
            fixture.Repository.MergeNoFF("release-1.3.0", Constants.SignatureNow());
            // Not 0 for commit count as we can't know the increment rules of the merged branch
            fixture.AssertFullSemver("1.4.0-unstable.2");
        }
    }
Example #17
0
 public void WhenDevelopBranchedFromMaster_MinorIsIncreased()
 {
     using (var fixture = new EmptyRepositoryFixture())
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.CreateBranch("develop").Checkout();
         fixture.AssertFullSemver("1.1.0-unstable.0+0");
     }
 }
Example #18
0
 public void WhenDevelopBranchedFromTaggedCommitOnMasterVersionDoesNotChange()
 {
     using (var fixture = new EmptyRepositoryFixture())
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
         fixture.AssertFullSemver("1.0.0");
     }
 }
    public void GitFlowMajorRelease()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.SequenceDiagram.Participant("master");
            fixture.SequenceDiagram.Participant("develop");

            fixture.Repository.MakeACommit();
            fixture.ApplyTag("1.3.0");

            // GitFlow setup
            fixture.BranchTo("develop");
            fixture.MakeACommit();

            // Create release branch
            fixture.BranchTo("release/2.0.0", "release");
            fixture.SequenceDiagram.Activate("release/2.0.0");
            fixture.AssertFullSemver("2.0.0-beta.1+0");

            // Make another commit on develop
            fixture.Checkout("develop");
            fixture.MakeACommit();
            fixture.AssertFullSemver("2.1.0-alpha.1");

            // Make a commit to release-2.0.0
            fixture.Checkout("release/2.0.0");
            fixture.MakeACommit();
            fixture.AssertFullSemver("2.0.0-beta.1+1");

            // Apply beta.1 tag should be exact tag
            fixture.ApplyTag("2.0.0-beta.1");
            fixture.AssertFullSemver("2.0.0-beta.1");

            // Make a commit after a tag should bump up the beta
            fixture.MakeACommit();
            fixture.AssertFullSemver("2.0.0-beta.2+2");

            // Complete release
            fixture.Checkout("master");
            fixture.MergeNoFF("release/2.0.0");
            fixture.Checkout("develop");
            fixture.MergeNoFF("release/2.0.0");
            fixture.SequenceDiagram.Destroy("release/2.0.0");
            fixture.SequenceDiagram.NoteOver("Release branches are deleted once merged", "release/2.0.0");

            fixture.Checkout("master");
            fixture.AssertFullSemver("2.0.0+0");
            fixture.ApplyTag("2.0.0");
            fixture.AssertFullSemver("2.0.0");

            // Not 0 for commit count as we can't know the increment rules of the merged branch
            fixture.Checkout("develop");
            fixture.AssertFullSemver("2.1.0-alpha.4");
            Console.WriteLine(fixture.SequenceDiagram.GetDiagram());
        }
    }
    public void InvalidArgumentsExitCodeShouldNotBeZero()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: " /invalid-argument");

            result.ExitCode.ShouldBe(1);
            result.Output.ShouldContain("Could not parse command line parameter '/invalid-argument'");
        }
    }
Example #21
0
 public void WhenDeveloperBranchExistsDontTreatAsDevelop()
 {
     using (var fixture = new EmptyRepositoryFixture())
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.Checkout(fixture.Repository.CreateBranch("developer"));
         fixture.Repository.MakeACommit();
         fixture.AssertFullSemver("1.0.1-developer.1+1"); // this tag should be the branch name by default, not unstable
     }
 }
    public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommits_VersionShouldBeTag()
    {
        const string ExpectedNextVersion = "1.1.0";
        using (var fixture = new EmptyRepositoryFixture(new Config { NextVersion = ExpectedNextVersion }))
        {
            const string TaggedVersion = "1.0.3";
            fixture.Repository.MakeATaggedCommit(TaggedVersion);

            fixture.AssertFullSemver("1.0.3");
        }
    }
Example #23
0
    public void CanSpecifyTagPrefixes()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            const string TaggedVersion = "version-1.0.3";
            fixture.Repository.MakeATaggedCommit(TaggedVersion);
            fixture.Repository.MakeCommits(5);

            fixture.AssertFullSemver(new Config { TagPrefix = "version-" }, "1.0.4+5");
        }
    }
 public void WhenDevelopBranchedFromMasterWithLegacyVersionTags_DevelopCanUseReachableTag()
 {
     using (var fixture = new EmptyRepositoryFixture())
     {
         fixture.Repository.MakeCommits(5);
         fixture.Repository.MakeATaggedCommit("1.0.0.0");
         fixture.Repository.MakeCommits(2);
         fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
         fixture.AssertFullSemver("1.1.0-alpha.2");
     }
 }
Example #25
0
 public void CanClearDevelopTagViaConfig()
 {
     using (var fixture = new EmptyRepositoryFixture(new Config
     {
         DevelopBranchTag = ""
     }))
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.CreateBranch("develop").Checkout();
         fixture.AssertFullSemver("1.1.0+0");
     }
 }
Example #26
0
    public void CanTakeVersionFromReleaseBranchWithTagOverriden()
    {
        using (var fixture = new EmptyRepositoryFixture(new Config { ReleaseBranchTag = "rc" }))
        {
            fixture.Repository.MakeATaggedCommit("1.0.3");
            fixture.Repository.MakeCommits(5);
            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Repository.Checkout("release-2.0.0");

            fixture.AssertFullSemver("2.0.0-rc.1+5");
        }
    }
Example #27
0
    public void CanTakeVersionFromReleaseBranch()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeATaggedCommit("1.0.3");
            fixture.Repository.MakeCommits(5);
            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Repository.Checkout("release-2.0.0");

            fixture.AssertFullSemver("2.0.0-beta.1+5");
        }
    }
Example #28
0
 public void CanChangeDevelopTagViaConfig()
 {
     var config = new Config();
     config.Branches["develop"].Tag = "alpha";
     using (var fixture = new EmptyRepositoryFixture(config))
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.CreateBranch("develop").Checkout();
         fixture.Repository.MakeACommit();
         fixture.AssertFullSemver("1.1.0-alpha.1");
     }
 }
Example #29
0
        public void WhenDevelopBranchedFromMaster_MinorIsIncreased()
        {
            using (var fixture = new EmptyRepositoryFixture())
            {
                fixture.Repository.MakeATaggedCommit("1.0.0");
                fixture.Repository.CreateBranch("develop").Checkout();

                var result = fixture.ExecuteGitVersion();

                result.OutputVariables[VariableProvider.SemVer].ShouldBe("1.1.0.0-unstable");
            }
        }
Example #30
0
 public void CanHandleContinuousDelivery()
 {
     var config = new Config();
     config.Branches["develop"].VersioningMode = VersioningMode.ContinuousDelivery;
     using (var fixture = new EmptyRepositoryFixture(config))
     {
         fixture.Repository.MakeATaggedCommit("1.0.0");
         fixture.Repository.CreateBranch("develop").Checkout();
         fixture.Repository.MakeATaggedCommit("1.1.0-alpha7");
         fixture.AssertFullSemver("1.1.0-alpha.7");
     }
 }
    public void VerifyDevelopTracksMasterVersion()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeACommit("1");
            fixture.MakeATaggedCommit("1.0.0");
            fixture.MakeACommit();

            // branching increments the version
            fixture.BranchTo("develop");
            fixture.AssertFullSemver(config, "1.1.0-alpha.0");
            fixture.MakeACommit();
            fixture.AssertFullSemver(config, "1.1.0-alpha.1");

            // merging develop into master increments minor version on master
            fixture.Checkout("master");
            fixture.MergeNoFF("develop");
            fixture.AssertFullSemver(config, "1.1.0");

            // a commit on develop before the merge still has the same version number
            fixture.Checkout("develop");
            fixture.AssertFullSemver(config, "1.1.0-alpha.1");

            // moving on to further work on develop tracks master's version from the merge
            fixture.MakeACommit();
            fixture.AssertFullSemver(config, "1.2.0-alpha.1");

            // adding a commit to master increments patch
            fixture.Checkout("master");
            fixture.MakeACommit();
            fixture.AssertFullSemver(config, "1.1.1");

            // adding a commit to master doesn't change develop's version
            fixture.Checkout("develop");
            fixture.AssertFullSemver(config, "1.2.0-alpha.1");
        }
    }
Example #32
0
    private static async Task VerifyTagCheckoutVersionIsCalculatedProperly(Dictionary <string, string> env)
    {
        using var fixture = new EmptyRepositoryFixture();
        var remoteRepositoryPath = PathHelper.GetTempPath();

        RepositoryFixtureBase.Init(remoteRepositoryPath);
        using (var remoteRepository = new Repository(remoteRepositoryPath))
        {
            remoteRepository.Config.Set("user.name", "Test");
            remoteRepository.Config.Set("user.email", "*****@*****.**");
            fixture.Repository.Network.Remotes.Add("origin", remoteRepositoryPath);
            Console.WriteLine("Created git repository at {0}", remoteRepositoryPath);
            remoteRepository.MakeATaggedCommit("0.1.0");
            Commands.Checkout(remoteRepository, remoteRepository.CreateBranch("develop"));
            remoteRepository.MakeACommit();
            Commands.Checkout(remoteRepository, remoteRepository.CreateBranch("release/0.2.0"));
            remoteRepository.MakeACommit();
            Commands.Checkout(remoteRepository, TestBase.MainBranch);
            remoteRepository.MergeNoFF("release/0.2.0", Generate.SignatureNow());
            remoteRepository.MakeATaggedCommit("0.2.0");

            Commands.Fetch((Repository)fixture.Repository, "origin", Array.Empty <string>(), new FetchOptions(), null);
            Commands.Checkout(fixture.Repository, "0.2.0");
        }

        var programFixture = new ProgramFixture(fixture.RepositoryPath);

        programFixture.WithEnv(env.ToArray());

        var result = await programFixture.Run();

        result.ExitCode.ShouldBe(0);
        result.OutputVariables.FullSemVer.ShouldBe("0.2.0");

        // Cleanup repository files
        DirectoryHelper.DeleteDirectory(remoteRepositoryPath);
    }
Example #33
0
    public void CommitBetweenMergeReleaseToDevelopShouldNotResetCount()
    {
        var config = new Config
        {
            VersioningMode = VersioningMode.ContinuousDeployment
        };

        using var fixture = new EmptyRepositoryFixture();
        fixture.Repository.MakeACommit("initial");
        fixture.Repository.CreateBranch("develop");
        Commands.Checkout(fixture.Repository, "develop");
        fixture.Repository.CreateBranch("release-2.0.0");
        Commands.Checkout(fixture.Repository, "release-2.0.0");
        fixture.AssertFullSemver("2.0.0-beta.0", config);

        // Make some commits on release
        var commit1 = fixture.Repository.MakeACommit();

        fixture.Repository.MakeACommit();
        fixture.AssertFullSemver("2.0.0-beta.2", config);

        // Merge release to develop - emulate commit between other person release commit push and this commit merge to develop
        Commands.Checkout(fixture.Repository, "develop");
        fixture.Repository.Merge(commit1, Generate.SignatureNow(), new MergeOptions {
            FastForwardStrategy = FastForwardStrategy.NoFastForward
        });
        fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow());

        // Check version on release after merge to develop
        Commands.Checkout(fixture.Repository, "release-2.0.0");
        fixture.AssertFullSemver("2.0.0-beta.2", config);

        // Check version on release after making some new commits
        fixture.Repository.MakeACommit();
        fixture.Repository.MakeACommit();
        fixture.AssertFullSemver("2.0.0-beta.4", config);
    }
    public void GivenARemoteWithATagOnMaster_AndAPullRequestWithTwoCommits_AndBuildIsRunningInTeamCity_VersionIsCalculatedProperly(string pullRequestRef)
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            var remoteRepositoryPath = PathHelper.GetTempPath();
            Repository.Init(remoteRepositoryPath);
            using (var remoteRepository = new Repository(remoteRepositoryPath))
            {
                remoteRepository.Config.Set("user.name", "Test");
                remoteRepository.Config.Set("user.email", "*****@*****.**");
                fixture.Repository.Network.Remotes.Add("origin", remoteRepositoryPath);
                Console.WriteLine("Created git repository at {0}", remoteRepositoryPath);
                remoteRepository.MakeATaggedCommit("1.0.3");

                var branch = remoteRepository.CreateBranch("FeatureBranch");
                remoteRepository.Checkout(branch);
                remoteRepository.MakeCommits(2);
                remoteRepository.Checkout(remoteRepository.Head.Tip.Sha);
                //Emulate merge commit
                var mergeCommitSha = remoteRepository.MakeACommit().Sha;
                remoteRepository.Checkout("master"); // HEAD cannot be pointing at the merge commit
                remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha));

                // Checkout PR commit
                Commands.Fetch((Repository)fixture.Repository, "origin", new string[0], new FetchOptions(), null);
                fixture.Repository.Checkout(mergeCommitSha);
            }

            var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, isTeamCity: true);

            result.ExitCode.ShouldBe(0);
            result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest0005.3");

            // Cleanup repository files
            DirectoryHelper.DeleteDirectory(remoteRepositoryPath);
        }
    }
Example #35
0
    public void CommitsSinceVersionSourceGoesDownWhenDeletingAReleaseBranch()
    {
        var config = new Config
        {
            VersioningMode = VersioningMode.ContinuousDeployment
        };

        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.MakeACommit();
            fixture.ApplyTag("1.1.0");
            fixture.BranchTo("develop");
            fixture.MakeACommit("commit in develop");
            fixture.BranchTo("feature/featureA");
            fixture.MakeACommit("commit in featureA");
            fixture.MakeACommit("commit in featureA");
            fixture.Checkout("develop");
            fixture.MakeACommit("commit in develop");
            fixture.MakeACommit("commit in develop");
            fixture.BranchTo("release/1.2.0");
            fixture.MakeACommit("commit in release/1.2.0");
            fixture.Checkout("feature/featureA");
            fixture.MergeNoFF("develop");
            fixture.Checkout("develop");
            fixture.MergeNoFF("feature/featureA");
            fixture.Checkout("master");
            fixture.MergeNoFF("release/1.2.0");
            fixture.ApplyTag("1.2.0");
            fixture.Checkout("develop");
            fixture.MergeNoFF("release/1.2.0");
            fixture.SequenceDiagram.Destroy("release/1.2.0");
            fixture.Repository.Branches.Remove("release/1.2.0");

            var expectedFullSemVer = "1.3.0-alpha.6";
            fixture.AssertFullSemver(config, expectedFullSemVer);
        }
    }
Example #36
0
        public void HotfixOffReleaseBranchShouldNotResetCount()
        {
            var config = new Config
            {
                VersioningMode = VersioningMode.ContinuousDeployment
            };

            using var fixture = new EmptyRepositoryFixture();
            const string taggedVersion = "1.0.3";

            fixture.Repository.MakeATaggedCommit(taggedVersion);
            fixture.Repository.CreateBranch("develop");
            fixture.Checkout("develop");

            fixture.Repository.MakeCommits(1);

            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Checkout("release-2.0.0");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("2.0.0-beta.1", config);

            //tag it to bump to beta 2
            fixture.Repository.MakeCommits(4);

            fixture.AssertFullSemver("2.0.0-beta.5", config);

            //merge down to develop
            fixture.Repository.CreateBranch("hotfix-2.0.0");
            fixture.Repository.MakeCommits(2);

            //but keep working on the release
            fixture.Checkout("release-2.0.0");
            fixture.Repository.MergeNoFF("hotfix-2.0.0", Generate.SignatureNow());
            fixture.Repository.Branches.Remove(fixture.Repository.Branches["hotfix-2.0.0"]);
            fixture.AssertFullSemver("2.0.0-beta.7", config);
        }
Example #37
0
        public void VerifyForwardMerge()
        {
            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit("1");
            fixture.MakeATaggedCommit("1.0.0");
            fixture.MakeACommit(); // 1.0.1

            fixture.BranchTo("feature/foo", "foo");
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.0.2-foo.1", config);
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.0.2-foo.2", config);

            fixture.Checkout(MainBranch);
            fixture.MakeACommit();
            fixture.AssertFullSemver("1.0.2", config);
            fixture.Checkout("feature/foo");
            // This may seem surprising, but this happens because we branched off mainline
            // and incremented. Mainline has then moved on. We do not follow mainline
            // in feature branches, you need to merge mainline in to get the mainline version
            fixture.AssertFullSemver("1.0.2-foo.2", config);
            fixture.MergeNoFF(MainBranch);
            fixture.AssertFullSemver("1.0.3-foo.3", config);
        }
    public void CanChangeDevelopTagViaConfig()
    {
        var config = new Config
        {
            Branches =
            {
                {
                    "develop", new BranchConfig
                    {
                        Tag            = "alpha",
                        SourceBranches = new List <string>()
                    }
                }
            }
        };

        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
            fixture.Repository.MakeACommit();
            fixture.AssertFullSemver(config, "1.1.0-alpha.1");
        }
    }
Example #39
0
        public void Apply_IsAzure_DoesApply(string canonical, string name)
        {
            // Arrange
            _env.GetVariable("TF_BUILD").Returns("True");
            _env.GetVariable("BUILD_SOURCEBRANCH").Returns(canonical);
            using (var fixture = new EmptyRepositoryFixture())
            {
                var context = new VersionContext(fixture.Repository)
                {
                    Result =
                    {
                        BranchName          = "Default Name",
                        CanonicalBranchName = "Default Canonical Name"
                    }
                };

                // Act
                _sut.Apply(context);

                // Assert
                context.Result.BranchName.Should().Be(name);
                context.Result.CanonicalBranchName.Should().Be(canonical);
            }
        }
Example #40
0
    public void CanTakeVersionFromReleaseBranchWithTagOverridden()
    {
        var config = new Config
        {
            Branches =
            {
                { "release", new BranchConfig {
                      Tag = "rc"
                  } }
            }
        };

        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeATaggedCommit("1.0.3");
            fixture.Repository.MakeCommits(5);
            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Repository.Checkout("release-2.0.0");

            fixture.AssertFullSemver(config, "2.0.0-rc.1+0");
            fixture.Repository.MakeCommits(2);
            fixture.AssertFullSemver(config, "2.0.0-rc.1+2");
        }
    }
Example #41
0
    public void UsingDynamicRepositoryWithoutTargetBranchFails()
    {
        var repoName = Guid.NewGuid().ToString();
        var tempPath = Path.GetTempPath();
        var tempDir  = Path.Combine(tempPath, repoName);

        Directory.CreateDirectory(tempDir);

        try
        {
            using (var mainRepositoryFixture = new EmptyRepositoryFixture(new Config()))
            {
                mainRepositoryFixture.Repository.MakeACommit();

                var gitPreparer = new GitPreparer(mainRepositoryFixture.RepositoryPath, null, new Authentication(), false, tempDir);

                Should.Throw <Exception>(() => gitPreparer.Initialise(true, null));
            }
        }
        finally
        {
            Directory.Delete(tempDir, true);
        }
    }
        public void NoMergeBacksToDevelopInCaseThereAreChangesInReleaseBranch()
        {
            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit();
            fixture.BranchTo("develop");
            fixture.Repository.MakeCommits(3);
            fixture.BranchTo("release/1.0.0");
            fixture.Repository.MakeACommit();

            // Merge to main
            fixture.Checkout(MainBranch);
            fixture.Repository.MergeNoFF("release/1.0.0");
            fixture.Repository.ApplyTag("1.0.0");

            // Merge to develop
            fixture.Checkout("develop");
            fixture.Repository.MergeNoFF("release/1.0.0");
            fixture.AssertFullSemver("1.1.0-alpha.2");

            fixture.Repository.MakeACommit();
            fixture.Repository.Branches.Remove("release/1.0.0");

            fixture.AssertFullSemver("1.1.0-alpha.3");
        }
Example #43
0
        public void ShouldUseConfiguredTag(string tag, string featureName, string preReleaseTagName)
        {
            var config = new Config
            {
                Branches =
                {
                    { "feature", new BranchConfig {
                          Tag = tag
                      } }
                }
            };

            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeATaggedCommit("1.0.0");
            var featureBranchName = $"feature/{featureName}";

            fixture.Repository.CreateBranch(featureBranchName);
            Commands.Checkout(fixture.Repository, featureBranchName);
            fixture.Repository.MakeCommits(5);

            var expectedFullSemVer = $"1.0.1-{preReleaseTagName}.1+5";

            fixture.AssertFullSemver(config, expectedFullSemVer);
        }
Example #44
0
        public void AllowHavingMainInsteadOfMaster()
        {
            var config = new Config();

            config.Branches.Add("master", new BranchConfig
            {
                Regex          = "main",
                VersioningMode = VersioningMode.ContinuousDelivery,
                Tag            = "useBranchName",
                Increment      = IncrementStrategy.Patch,
                PreventIncrementOfMergedBranchVersion = true,
                TrackMergeTarget = false
            });

            using (var fixture = new EmptyRepositoryFixture())
            {
                fixture.Repository.MakeACommit();
                fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
                fixture.Repository.Checkout(fixture.Repository.CreateBranch("main"));
                fixture.Repository.Branches.Remove(fixture.Repository.Branches["master"]);

                fixture.AssertFullSemver(config, "0.1.0+0");
            }
        }
Example #45
0
        public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch()
        {
            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeATaggedCommit("1.0.0");
            fixture.Repository.CreateBranch("development");
            Commands.Checkout(fixture.Repository, "development");

            //Create an initial feature branch
            var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");

            Commands.Checkout(fixture.Repository, "feature/JIRA-123");
            fixture.Repository.MakeCommits(1);

            //Merge it
            Commands.Checkout(fixture.Repository, "development");
            fixture.Repository.Merge(feature123, Generate.SignatureNow());

            //Create a second feature branch
            fixture.Repository.CreateBranch("feature/JIRA-124");
            Commands.Checkout(fixture.Repository, "feature/JIRA-124");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
        }
        public void UsingDynamicRepositoryWithFeatureBranchWorks()
        {
            var repoName = Guid.NewGuid().ToString();
            var tempPath = Path.GetTempPath();
            var tempDir  = Path.Combine(tempPath, repoName);

            Directory.CreateDirectory(tempDir);

            try
            {
                using (var mainRepositoryFixture = new EmptyRepositoryFixture())
                {
                    mainRepositoryFixture.Repository.MakeACommit();

                    var repositoryInfo = new RepositoryInfo
                    {
                        Url    = mainRepositoryFixture.RepositoryPath,
                        Branch = "feature1"
                    };

                    mainRepositoryFixture.Repository.Checkout(mainRepositoryFixture.Repository.CreateBranch("feature1"));

                    Should.NotThrow(() =>
                    {
                        using (var gitRepository = GitRepositoryFactory.CreateRepository(repositoryInfo))
                        {
                            // this code shouldn't throw
                        }
                    });
                }
            }
            finally
            {
                Directory.Delete(tempDir, true);
            }
        }
Example #47
0
    public void WhenMergingReleaseBackToDevShouldNotResetBetaVersion()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            const string TaggedVersion = "1.0.3";
            fixture.Repository.MakeATaggedCommit(TaggedVersion);
            fixture.Repository.CreateBranch("develop");
            fixture.Repository.Checkout("develop");

            fixture.Repository.MakeCommits(1);
            fixture.AssertFullSemver("1.1.0-alpha.1");

            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Repository.Checkout("release-2.0.0");
            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("2.0.0-beta.1+1");

            //tag it to bump to beta 2
            fixture.Repository.ApplyTag("2.0.0-beta1");

            fixture.Repository.MakeCommits(1);

            fixture.AssertFullSemver("2.0.0-beta.2+2");

            //merge down to develop
            fixture.Repository.Checkout("develop");
            fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow());

            //but keep working on the release
            fixture.Repository.Checkout("release-2.0.0");
            fixture.AssertFullSemver("2.0.0-beta.2+2");
            fixture.MakeACommit();
            fixture.AssertFullSemver("2.0.0-beta.2+3");
        }
    }
        public void UpdatesCurrentBranch()
        {
            using (var fixture = new EmptyRepositoryFixture())
            {
                fixture.Repository.MakeACommit();
                Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
                fixture.Repository.MakeACommit();
                Commands.Checkout(fixture.Repository, "master");
                using (var localFixture = fixture.CloneRepository())
                {
                    // Advance remote
                    Commands.Checkout(fixture.Repository, "develop");
                    var advancedCommit = fixture.Repository.MakeACommit();
                    Commands.Fetch((Repository)localFixture.Repository, localFixture.Repository.Network.Remotes["origin"].Name, new string[0], null, null);
                    Commands.Checkout(localFixture.Repository, advancedCommit.Sha);
                    GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: "refs/heads/develop");

                    var normalisedBranch = localFixture.Repository.Branches["develop"];
                    normalisedBranch.ShouldNotBe(null);
                    normalisedBranch.Tip.Sha.ShouldBe(advancedCommit.Sha);
                    localFixture.Repository.Head.Tip.Sha.ShouldBe(advancedCommit.Sha);
                }
            }
        }
Example #49
0
    public void ShouldUseConfiguredTag(string tag, string featureName, string preReleaseTagName)
    {
        var config = new Config
        {
            Branches =
            {
                { "features?[/-]", new BranchConfig {
                      Tag = tag
                  } }
            }
        };

        using (var fixture = new EmptyRepositoryFixture(config))
        {
            fixture.Repository.MakeATaggedCommit("1.0.0");
            var featureBranchName = string.Format("feature/{0}", featureName);
            fixture.Repository.CreateBranch(featureBranchName);
            fixture.Repository.Checkout(featureBranchName);
            fixture.Repository.MakeCommits(5);

            var expectedFullSemVer = string.Format("1.0.1-{0}.1+5", preReleaseTagName);
            fixture.AssertFullSemver(expectedFullSemVer);
        }
    }
        public void Apply_LabelParts_Release_Is_Formatted(
            string[] parts,
            string version,
            int height,
            string expected)
        {
            // Arrange
            using (var fixture = new EmptyRepositoryFixture())
            {
                var context = new VersionContext(fixture.Repository)
                {
                    Configuration = Utils.GetConfiguration(version, parts),
                    Result        = Utils.GetVersionResult(height)
                };
                context.Result.Version = context.Configuration.Version;

                // Act
                _sut.Apply(context);

                // Assert
                context.Result.Formats.Should().ContainKey("Semver2");
                context.Result.Formats["Semver2"].Should().Be(expected);
            }
        }
Example #51
0
        private static void VerifyPullRequestVersionIsCalculatedProperly(string pullRequestRef, params KeyValuePair <string, string>[] env)
        {
            using var fixture = new EmptyRepositoryFixture();
            var remoteRepositoryPath = PathHelper.GetTempPath();

            Repository.Init(remoteRepositoryPath);
            using (var remoteRepository = new Repository(remoteRepositoryPath))
            {
                remoteRepository.Config.Set("user.name", "Test");
                remoteRepository.Config.Set("user.email", "*****@*****.**");
                fixture.Repository.Network.Remotes.Add("origin", remoteRepositoryPath);
                Console.WriteLine("Created git repository at {0}", remoteRepositoryPath);
                remoteRepository.MakeATaggedCommit("1.0.3");

                var branch = remoteRepository.CreateBranch("FeatureBranch");
                Commands.Checkout(remoteRepository, branch);
                remoteRepository.MakeCommits(2);
                Commands.Checkout(remoteRepository, remoteRepository.Head.Tip.Sha);
                //Emulate merge commit
                var mergeCommitSha = remoteRepository.MakeACommit().Sha;
                Commands.Checkout(remoteRepository, "master"); // HEAD cannot be pointing at the merge commit
                remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha));

                // Checkout PR commit
                Commands.Fetch((Repository)fixture.Repository, "origin", new string[0], new FetchOptions(), null);
                Commands.Checkout(fixture.Repository, mergeCommitSha);
            }

            var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, environments: env);

            result.ExitCode.ShouldBe(0);
            result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest0005.3");

            // Cleanup repository files
            DirectoryHelper.DeleteDirectory(remoteRepositoryPath);
        }
        public void AssemblySemFileVerShouldBeWeightedByPreReleaseWeight()
        {
            var config = new Config
            {
                AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}",
                Branches =
                {
                    { "release", new BranchConfig
                        {
                            PreReleaseWeight = 1000
                        } }
                }
            };

            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeATaggedCommit("1.0.3");
            fixture.Repository.MakeCommits(5);
            fixture.Repository.CreateBranch("release-2.0.0");
            fixture.Checkout("release-2.0.0");
            config.Reset();
            var variables = fixture.GetVersion(config);

            Assert.AreEqual(variables.AssemblySemFileVer, "2.0.0.1001");
        }
        public void FindsCorrectMergeBaseForMultipleForwardMerges()
        {
            //*403b294 44 minutes ago(develop)
            //|\
            //| *306b243 45 minutes ago(HEAD -> release-2.0.0)
            //| *4cf5969 47 minutes ago
            //| *4814083 51 minutes ago
            //* | cddd3cc 49 minutes ago
            //* | 2b2b52a 53 minutes ago
            //|\ \
            //| |/
            //| *8113776 54 minutes ago
            //| *3c0235e 56 minutes ago
            //|/
            //*f6f1283 58 minutes ago(main)

            using var fixture = new EmptyRepositoryFixture();
            fixture.MakeACommit("initial");
            fixture.BranchTo("develop");
            var fixtureRepository        = fixture.Repository.ToGitRepository();
            var expectedReleaseMergeBase = fixtureRepository.Head.Tip;

            // Create release from develop
            fixture.BranchTo("release-2.0.0");

            // Make some commits on release
            fixture.MakeACommit("release 1");
            fixture.MakeACommit("release 2");

            // First forward merge release to develop
            fixture.Checkout("develop");
            fixture.MergeNoFF("release-2.0.0");

            // Make some new commit on release
            fixture.Checkout("release-2.0.0");
            fixture.MakeACommit("release 3 - after first merge");

            // Make new commit on develop
            fixture.Checkout("develop");
            // Checkout to release (no new commits)
            fixture.Checkout("release-2.0.0");
            fixture.Checkout("develop");
            fixture.MakeACommit("develop after merge");

            // Checkout to release (no new commits)
            fixture.Checkout("release-2.0.0");

            // Make some new commit on release
            fixture.MakeACommit("release 4");
            fixture.MakeACommit("release 5");
            var expectedDevelopMergeBase = fixtureRepository.Head.Tip;

            // Second merge release to develop
            fixture.Checkout("develop");
            fixture.MergeNoFF("release-2.0.0");

            // Checkout to release (no new commits)
            fixture.Checkout("release-2.0.0");

            var develop = fixtureRepository.FindBranch("develop");
            var release = fixtureRepository.FindBranch("release-2.0.0");

            var gitRepoMetadataProvider = new RepositoryStore(log, fixtureRepository);

            var releaseBranchMergeBase = gitRepoMetadataProvider.FindMergeBase(release, develop);

            var developMergeBase = gitRepoMetadataProvider.FindMergeBase(develop, release);

            fixtureRepository.DumpGraph(Console.WriteLine);

            releaseBranchMergeBase.ShouldBe(expectedReleaseMergeBase);
            developMergeBase.ShouldBe(expectedDevelopMergeBase);
        }
    public void MergedFeatureBranchesToMasterImpliesRelease()
    {
        using (var fixture = new EmptyRepositoryFixture())
        {
            fixture.Repository.MakeACommit("1");
            fixture.MakeATaggedCommit("1.0.0");

            fixture.BranchTo("feature/foo", "foo");
            fixture.MakeACommit("2");
            fixture.AssertFullSemver(config, "1.0.1-foo.1");
            fixture.MakeACommit("2.1");
            fixture.AssertFullSemver(config, "1.0.1-foo.2");
            fixture.Checkout("master");
            fixture.MergeNoFF("feature/foo");

            fixture.AssertFullSemver(config, "1.0.1");

            fixture.BranchTo("feature/foo2", "foo2");
            fixture.MakeACommit("3 +semver: minor");
            fixture.AssertFullSemver(config, "1.1.0-foo2.1");
            fixture.Checkout("master");
            fixture.MergeNoFF("feature/foo2");
            fixture.AssertFullSemver(config, "1.1.0");

            fixture.BranchTo("feature/foo3", "foo3");
            fixture.MakeACommit("4");
            fixture.Checkout("master");
            fixture.MergeNoFF("feature/foo3");
            fixture.SequenceDiagram.NoteOver("Merge message contains '+semver: minor'", "master");
            var commit = fixture.Repository.Head.Tip;
            // Put semver increment in merge message
            fixture.Repository.Commit(commit.Message + " +semver: minor", commit.Author, commit.Committer, new CommitOptions
            {
                AmendPreviousCommit = true
            });
            fixture.AssertFullSemver(config, "1.2.0");

            fixture.BranchTo("feature/foo4", "foo4");
            fixture.MakeACommit("5 +semver: major");
            fixture.AssertFullSemver(config, "2.0.0-foo4.1");
            fixture.Checkout("master");
            fixture.MergeNoFF("feature/foo4");
            fixture.AssertFullSemver(config, "2.0.0");

            // We should evaluate any commits not included in merge commit calculations for direct commit/push or squash to merge commits
            fixture.MakeACommit("6 +semver: major");
            fixture.AssertFullSemver(config, "3.0.0");
            fixture.MakeACommit("7 +semver: minor");
            fixture.AssertFullSemver(config, "3.1.0");
            fixture.MakeACommit("8");
            fixture.AssertFullSemver(config, "3.1.1");

            // Finally verify that the merge commits still function properly
            fixture.BranchTo("feature/foo5", "foo5");
            fixture.MakeACommit("9 +semver: minor");
            fixture.AssertFullSemver(config, "3.2.0-foo5.1");
            fixture.Checkout("master");
            fixture.MergeNoFF("feature/foo5");
            fixture.AssertFullSemver(config, "3.2.0");

            // One more direct commit for good measure
            fixture.MakeACommit("10 +semver: minor");
            fixture.AssertFullSemver(config, "3.3.0");
            // And we can commit without bumping semver
            fixture.MakeACommit("11 +semver: none");
            fixture.AssertFullSemver(config, "3.3.0");
            Console.WriteLine(fixture.SequenceDiagram.GetDiagram());
        }
    }
        public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommitsSinceVersionSourceShouldNotGoDownWhenMergingHotfixToDevelop()
        {
            var config = new Config
            {
                VersioningMode = VersioningMode.ContinuousDeployment,
                Branches       = new Dictionary <string, BranchConfig>
                {
                    { "develop", new BranchConfig {
                          PreventIncrementOfMergedBranchVersion = false
                      } },
                    { "hotfix", new BranchConfig {
                          PreventIncrementOfMergedBranchVersion = true, Regex = "^(origin/)?hotfix[/-]"
                      } },
                }
            };

            using var fixture = new EmptyRepositoryFixture();
            fixture.MakeACommit();
            fixture.BranchTo("develop");
            fixture.MakeATaggedCommit("1.0.0");
            fixture.Repository.MakeCommits(1);

            fixture.Checkout("develop");
            fixture.Repository.MakeCommits(3);
            fixture.AssertFullSemver("1.1.0-alpha.4", config);

            const string ReleaseBranch = "release/1.1.0";

            Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(ReleaseBranch));
            fixture.Repository.MakeCommits(3);
            fixture.AssertFullSemver("1.1.0-beta.3", config);

            // Simulate a GitFlow release finish.
            fixture.Checkout("master");
            fixture.MergeNoFF(ReleaseBranch);
            fixture.ApplyTag("v1.1.0");
            fixture.Checkout("develop");

            // Simulate some work done on develop while the release branch was open.
            fixture.Repository.MakeCommits(2);
            fixture.MergeNoFF(ReleaseBranch);
            fixture.Repository.Branches.Remove(ReleaseBranch);
            fixture.AssertFullSemver("1.2.0-alpha.6", config);

            // Create hotfix for defects found in release/1.1.0
            const string HotfixBranch = "hotfix/1.1.1";

            fixture.Checkout("master");
            Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(HotfixBranch));
            fixture.Repository.MakeCommits(3);

            // Hotfix finish
            fixture.Checkout("master");
            fixture.Repository.MergeNoFF(HotfixBranch);
            fixture.Repository.ApplyTag("v1.1.1");

            // Verify develop version
            fixture.Checkout("develop");
            // Simulate some work done on develop while the hotfix branch was open.
            fixture.Repository.MakeCommits(3);
            fixture.AssertFullSemver("1.2.0-alpha.9", config);
            fixture.Repository.MergeNoFF(HotfixBranch);
            fixture.AssertFullSemver("1.2.0-alpha.19", config);

            fixture.Repository.Branches.Remove(HotfixBranch);
            fixture.AssertFullSemver("1.2.0-alpha.19", config);
        }
Example #56
0
        public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDynamicallyCalculatedWithoutSavingInCache()
        {
            const string versionCacheFileContent = @"
        Major: 4
        Minor: 10
        Patch: 3
        PreReleaseTag: test.19
        PreReleaseTagWithDash: -test.19
        PreReleaseLabel: test
        PreReleaseLabelWithDash: -test
        PreReleaseNumber: 19
        BuildMetaData:
        BuildMetaDataPadded:
        FullBuildMetaData: Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        MajorMinorPatch: 4.10.3
        SemVer: 4.10.3-test.19
        LegacySemVer: 4.10.3-test19
        LegacySemVerPadded: 4.10.3-test0019
        AssemblySemVer: 4.10.3.0
        AssemblySemFileVer: 4.10.3.0
        FullSemVer: 4.10.3-test.19
        InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        BranchName: feature/test
        EscapedBranchName: feature-test
        Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        ShortSha: dd2a29af
        NuGetVersionV2: 4.10.3-test0019
        NuGetVersion: 4.10.3-test0019
        NuGetPreReleaseTagV2: test0019
        NuGetPreReleaseTag: test0019
        CommitsSinceVersionSource: 19
        CommitsSinceVersionSourcePadded: 0019
        CommitDate: 2015-11-10
        UncommittedChanges: 0
        ";

            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit();

            var gitVersionOptions = new GitVersionOptions {
                WorkingDirectory = fixture.RepositoryPath
            };
            var gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, log);

            var versionVariables = gitVersionCalculator.CalculateVersionVariables();

            versionVariables.AssemblySemVer.ShouldBe("0.1.0.0");

            fileSystem.WriteAllText(versionVariables.FileName, versionCacheFileContent);

            var cacheDirectory = gitVersionCache.GetCacheDirectory();

            var cacheDirectoryTimestamp = fileSystem.GetLastDirectoryWrite(cacheDirectory);

            var config = new ConfigurationBuilder().Add(new Config {
                TagPrefix = "prefix"
            }).Build();

            gitVersionOptions = new GitVersionOptions {
                WorkingDirectory = fixture.RepositoryPath, ConfigInfo = { OverrideConfig = config }
            };

            gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions);
            versionVariables     = gitVersionCalculator.CalculateVersionVariables();

            versionVariables.AssemblySemVer.ShouldBe("0.1.0.0");

            var cachedDirectoryTimestampAfter = fileSystem.GetLastDirectoryWrite(cacheDirectory);

            cachedDirectoryTimestampAfter.ShouldBe(cacheDirectoryTimestamp, "Cache was updated when override config was set");
        }
Example #57
0
        public void VerifyIncrementConfigIsHonoured()
        {
            var minorIncrementConfig = new Config
            {
                VersioningMode = VersioningMode.Mainline,
                Increment      = IncrementStrategy.Minor,
                Branches       = new Dictionary <string, BranchConfig>
                {
                    {
                        MainBranch,
                        new BranchConfig
                        {
                            Increment = IncrementStrategy.Minor,
                            Name      = MainBranch,
                            Regex     = MainBranch
                        }
                    },
                    {
                        "feature",
                        new BranchConfig
                        {
                            Increment = IncrementStrategy.Minor,
                            Name      = "feature",
                            Regex     = "features?[/-]"
                        }
                    }
                }
            };

            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit("1");
            fixture.MakeATaggedCommit("1.0.0");

            fixture.BranchTo("feature/foo", "foo");
            fixture.MakeACommit("2");
            fixture.AssertFullSemver("1.1.0-foo.1", minorIncrementConfig);
            fixture.MakeACommit("2.1");
            fixture.AssertFullSemver("1.1.0-foo.2", minorIncrementConfig);
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF("feature/foo");

            fixture.AssertFullSemver("1.1.0", minorIncrementConfig);

            fixture.BranchTo("feature/foo2", "foo2");
            fixture.MakeACommit("3 +semver: patch");
            fixture.AssertFullSemver("1.1.1-foo2.1", minorIncrementConfig);
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF("feature/foo2");
            fixture.AssertFullSemver("1.1.1", minorIncrementConfig);

            fixture.BranchTo("feature/foo3", "foo3");
            fixture.MakeACommit("4");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF("feature/foo3");
            fixture.SequenceDiagram.NoteOver("Merge message contains '+semver: patch'", MainBranch);
            var commit = fixture.Repository.Head.Tip;

            // Put semver increment in merge message
            fixture.Repository.Commit(commit.Message + " +semver: patch", commit.Author, commit.Committer, new CommitOptions
            {
                AmendPreviousCommit = true
            });
            fixture.AssertFullSemver("1.1.2", minorIncrementConfig);

            fixture.BranchTo("feature/foo4", "foo4");
            fixture.MakeACommit("5 +semver: major");
            fixture.AssertFullSemver("2.0.0-foo4.1", minorIncrementConfig);
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF("feature/foo4");
            fixture.AssertFullSemver("2.0.0", config);

            // We should evaluate any commits not included in merge commit calculations for direct commit/push or squash to merge commits
            fixture.MakeACommit("6 +semver: major");
            fixture.AssertFullSemver("3.0.0", minorIncrementConfig);
            fixture.MakeACommit("7");
            fixture.AssertFullSemver("3.1.0", minorIncrementConfig);
            fixture.MakeACommit("8 +semver: patch");
            fixture.AssertFullSemver("3.1.1", minorIncrementConfig);

            // Finally verify that the merge commits still function properly
            fixture.BranchTo("feature/foo5", "foo5");
            fixture.MakeACommit("9 +semver: patch");
            fixture.AssertFullSemver("3.1.2-foo5.1", minorIncrementConfig);
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF("feature/foo5");
            fixture.AssertFullSemver("3.1.2", minorIncrementConfig);

            // One more direct commit for good measure
            fixture.MakeACommit("10 +semver: patch");
            fixture.AssertFullSemver("3.1.3", minorIncrementConfig);
            // And we can commit without bumping semver
            fixture.MakeACommit("11 +semver: none");
            fixture.AssertFullSemver("3.1.3", minorIncrementConfig);
            Console.WriteLine(fixture.SequenceDiagram.GetDiagram());
        }
Example #58
0
        public void CacheFileExistsOnDisk()
        {
            const string versionCacheFileContent = @"
        Major: 4
        Minor: 10
        Patch: 3
        PreReleaseTag: test.19
        PreReleaseTagWithDash: -test.19
        PreReleaseLabel: test
        PreReleaseLabelWithDash: -test
        PreReleaseNumber: 19
        WeightedPreReleaseNumber: 19
        BuildMetaData:
        BuildMetaDataPadded:
        FullBuildMetaData: Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        MajorMinorPatch: 4.10.3
        SemVer: 4.10.3-test.19
        LegacySemVer: 4.10.3-test19
        LegacySemVerPadded: 4.10.3-test0019
        AssemblySemVer: 4.10.3.0
        AssemblySemFileVer: 4.10.3.0
        FullSemVer: 4.10.3-test.19
        InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        BranchName: feature/test
        EscapedBranchName: feature-test
        Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        ShortSha: dd2a29af
        NuGetVersionV2: 4.10.3-test0019
        NuGetVersion: 4.10.3-test0019
        NuGetPreReleaseTagV2: test0019
        NuGetPreReleaseTag: test0019
        VersionSourceSha: 4.10.2
        CommitsSinceVersionSource: 19
        CommitsSinceVersionSourcePadded: 0019
        CommitDate: 2015-11-10
        UncommittedChanges: 0
        ";

            var stringBuilder = new StringBuilder();

            void Action(string s) => stringBuilder.AppendLine(s);

            var logAppender = new TestLogAppender(Action);

            log = new Log(logAppender);

            using var fixture = new EmptyRepositoryFixture();
            fixture.Repository.MakeACommit();

            var gitVersionOptions = new GitVersionOptions {
                WorkingDirectory = fixture.RepositoryPath
            };

            var gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, log);

            var versionVariables = gitVersionCalculator.CalculateVersionVariables();

            versionVariables.AssemblySemVer.ShouldBe("0.1.0.0");

            fileSystem.WriteAllText(versionVariables.FileName, versionCacheFileContent);
            versionVariables = gitVersionCalculator.CalculateVersionVariables();
            versionVariables.AssemblySemVer.ShouldBe("4.10.3.0");

            var logsMessages = stringBuilder.ToString();

            logsMessages.ShouldContain("Deserializing version variables from cache file", Case.Insensitive, logsMessages);
        }
Example #59
0
        public void UsesFirstBranchConfigWhenMultipleMatch()
        {
            using var fixture = new EmptyRepositoryFixture();

            var branchConfig = new BranchConfig
            {
                VersioningMode = VersioningMode.Mainline,
                Increment      = IncrementStrategy.None,
                PreventIncrementOfMergedBranchVersion = false,
                TrackMergeTarget      = false,
                TracksReleaseBranches = false,
                IsReleaseBranch       = false,
                SourceBranches        = new HashSet <string>()
            };
            var config = new ConfigurationBuilder()
                         .Add(new Config
            {
                VersioningMode = VersioningMode.ContinuousDelivery,
                Branches       =
                {
                    { "release/latest", new BranchConfig(branchConfig)
                                          {
                                              Increment = IncrementStrategy.None, Regex = "release/latest"
                                          } },
                    { "release", new BranchConfig(branchConfig)
                                          {
                                              Increment = IncrementStrategy.Patch, Regex = "releases?[/-]"
                                          } }
                }
            })
                         .Build();

            var releaseLatestBranch = new MockBranch("release/latest")
            {
                new MockCommit {
                    CommitterEx = Generate.SignatureNow()
                }
            };
            var releaseVersionBranch = new MockBranch("release/1.0.0")
            {
                new MockCommit {
                    CommitterEx = Generate.SignatureNow()
                }
            };

            var mockRepository = new MockRepository
            {
                Branches = new MockBranchCollection
                {
                    releaseLatestBranch,
                    releaseVersionBranch
                },
                Head = releaseLatestBranch
            };

            var latestContext = GetGitVersionContext(fixture.RepositoryPath, mockRepository, releaseLatestBranch.CanonicalName, config);

            latestContext.Configuration.Increment.ShouldBe(IncrementStrategy.None);

            mockRepository.Head = releaseVersionBranch;
            var versionContext = GetGitVersionContext(fixture.RepositoryPath, mockRepository, releaseVersionBranch.CanonicalName, config);

            versionContext.Configuration.Increment.ShouldBe(IncrementStrategy.Patch);
        }
Example #60
0
        public void ConfigChangeInvalidatesCache()
        {
            const string versionCacheFileContent = @"
        Major: 4
        Minor: 10
        Patch: 3
        PreReleaseTag: test.19
        PreReleaseTagWithDash: -test.19
        PreReleaseLabel: test
        PreReleaseLabelWithDash: -test
        PreReleaseNumber: 19
        WeightedPreReleaseNumber: 19
        BuildMetaData:
        BuildMetaDataPadded:
        FullBuildMetaData: Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        MajorMinorPatch: 4.10.3
        SemVer: 4.10.3-test.19
        LegacySemVer: 4.10.3-test19
        LegacySemVerPadded: 4.10.3-test0019
        AssemblySemVer: 4.10.3.0
        AssemblySemFileVer: 4.10.3.0
        FullSemVer: 4.10.3-test.19
        InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        BranchName: feature/test
        EscapedBranchName: feature-test
        Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
        ShortSha: dd2a29af
        NuGetVersionV2: 4.10.3-test0019
        NuGetVersion: 4.10.3-test0019
        NuGetPreReleaseTagV2: test0019
        NuGetPreReleaseTag: test0019
        VersionSourceSha: 4.10.2
        CommitsSinceVersionSource: 19
        CommitsSinceVersionSourcePadded: 0019
        CommitDate: 2015-11-10
        UncommittedChanges: 0 
        ";

            using var fixture = new EmptyRepositoryFixture();

            var gitVersionOptions = new GitVersionOptions {
                WorkingDirectory = fixture.RepositoryPath
            };

            fixture.Repository.MakeACommit();

            var gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions);
            var versionVariables     = gitVersionCalculator.CalculateVersionVariables();

            versionVariables.AssemblySemVer.ShouldBe("0.1.0.0");
            versionVariables.FileName.ShouldNotBeNullOrEmpty();

            fileSystem.WriteAllText(versionVariables.FileName, versionCacheFileContent);

            versionVariables = gitVersionCalculator.CalculateVersionVariables();
            versionVariables.AssemblySemVer.ShouldBe("4.10.3.0");

            var configPath = Path.Combine(fixture.RepositoryPath, DefaultConfigFileLocator.DefaultFileName);

            fileSystem.WriteAllText(configPath, "next-version: 5.0");

            gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, fs: fileSystem);

            versionVariables = gitVersionCalculator.CalculateVersionVariables();
            versionVariables.AssemblySemVer.ShouldBe("5.0.0.0");
        }