Exemplo n.º 1
0
    public void TagPreReleaseWeightIsNotConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheDefaultValue()
    {
        // Arrange
        var config = new ConfigurationBuilder()
                     .Add(new Config
        {
            AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}",
            VersioningMode = VersioningMode.ContinuousDeployment
        })
                     .Build();

        // Act
        using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
        fixture.Checkout(TestBase.MainBranch);
        fixture.MergeNoFF("develop");
        fixture.Checkout("develop");
        fixture.MakeACommit("Feature commit 1");
        fixture.BranchTo("release/1.1.0");
        fixture.MakeACommit("Release commit 1");
        fixture.AssertFullSemver("1.1.0-beta.1", config);
        fixture.ApplyTag("1.1.0");
        var version = fixture.GetVersion(config);

        // Assert
        version.AssemblySemFileVer.ShouldBe("1.1.0.60000");
    }
        public void TagPreReleaseWeightIsConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheSameAsTheTagPreReleaseWeight()
        {
            // Arrange
            var config = new TestableConfig()
            {
                AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}",
                TagPreReleaseWeight          = 65535,
                VersioningMode = VersioningMode.ContinuousDeployment
            };

            config.ApplyDefaults();

            // Act
            using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
            fixture.Checkout("master");
            fixture.MergeNoFF("develop");
            fixture.Checkout("develop");
            fixture.MakeACommit("Feature commit 1");
            fixture.BranchTo("release/1.1.0");
            fixture.MakeACommit("Release commit 1");
            fixture.AssertFullSemver("1.1.0-beta.1", config);
            fixture.ApplyTag("1.1.0");
            var version = fixture.GetVersion(config);

            // Assert
            version.AssemblySemFileVer.ShouldBe("1.1.0.65535");
        }
Exemplo n.º 3
0
        public void GitflowComplexExample()
        {
            const string developBranch  = "develop";
            const string feature1Branch = "feature/f1";
            const string feature2Branch = "feature/f2";
            const string release1Branch = "release/1.1.0";
            const string release2Branch = "release/1.2.0";
            const string hotfixBranch   = "hotfix/hf";

            using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
            fixture.AssertFullSemver("1.1.0-alpha.1");

            // Feature 1
            fixture.BranchTo(feature1Branch);
            fixture.MakeACommit("added feature 1");
            fixture.AssertFullSemver("1.1.0-f1.1+2");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(feature1Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[feature1Branch]);
            fixture.AssertFullSemver("1.1.0-alpha.3");

            // Release 1.1.0
            fixture.BranchTo(release1Branch);
            fixture.MakeACommit("release stabilization");
            fixture.AssertFullSemver("1.1.0-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(release1Branch);
            fixture.AssertFullSemver("1.1.0+0");
            fixture.ApplyTag("1.1.0");
            fixture.AssertFullSemver("1.1.0");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(release1Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[release1Branch]);
            fixture.AssertFullSemver("1.2.0-alpha.1");

            // Feature 2
            fixture.BranchTo(feature2Branch);
            fixture.MakeACommit("added feature 2");
            fixture.AssertFullSemver("1.2.0-f2.1+2");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(feature2Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[feature2Branch]);
            fixture.AssertFullSemver("1.2.0-alpha.3");

            // Release 1.2.0
            fixture.BranchTo(release2Branch);
            fixture.MakeACommit("release stabilization");
            fixture.AssertFullSemver("1.2.0-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(release2Branch);
            fixture.AssertFullSemver("1.2.0+0");
            fixture.ApplyTag("1.2.0");
            fixture.AssertFullSemver("1.2.0");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(release2Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[release2Branch]);
            fixture.AssertFullSemver("1.3.0-alpha.1");

            // Hotfix
            fixture.Checkout(MainBranch);
            fixture.BranchTo(hotfixBranch);
            fixture.MakeACommit("added hotfix");
            fixture.AssertFullSemver("1.2.1-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(hotfixBranch);
            fixture.AssertFullSemver("1.2.1+2");
            fixture.ApplyTag("1.2.1");
            fixture.AssertFullSemver("1.2.1");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(hotfixBranch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[hotfixBranch]);
            fixture.AssertFullSemver("1.3.0-alpha.3");
        }