diff --git a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs index 2b9a02fc2a..59a71a43e7 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs @@ -560,13 +560,11 @@ public void PreventDecrementationOfVersionsOnTheMainBranch() [Test] public void ShouldProvideTheCorrectVersionEvenIfPreReleaseLabelExistsInTheGitTag() { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit(); - fixture.ApplyTag("1.0.0-oreo.1"); - fixture.BranchTo("develop"); - fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("1.1.0-alpha.1"); - } + using var fixture = new EmptyRepositoryFixture(); + fixture.Repository.MakeACommit(); + fixture.ApplyTag("1.0.0-oreo.1"); + fixture.BranchTo("develop"); + fixture.Repository.MakeACommit(); + fixture.AssertFullSemver("1.1.0-alpha.1"); } } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs index aa44e5dc4c..e401cc6375 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs @@ -410,32 +410,23 @@ public void TrackMergeMessageShouldBeConsideredOnTheMainBranch(bool trackMergeMe [Test] public void ShouldProvideTheCorrectVersionEvenIfPreReleaseLabelExistsInTheGitTag() { - var config = new Config - { - NextVersion = "5.0", - Branches = - { - { - "master", new BranchConfig - { - Regex = "master", - Tag = "beta", - Increment = IncrementStrategy.Patch, - VersioningMode = VersioningMode.ContinuousDeployment - } - } - } - }; - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit(); - fixture.AssertFullSemver(config, "5.0.0-beta.0"); // why not "5.0.0-beta.1"? - fixture.Repository.MakeACommit(); - fixture.AssertFullSemver(config, "5.0.0-beta.1"); - fixture.Repository.MakeATaggedCommit("v5.0.0-rc.1"); - fixture.AssertFullSemver(config, "5.0.0-rc.1"); - fixture.Repository.MakeACommit(); - fixture.AssertFullSemver(config, "5.0.1-beta.1"); // test fails here, it generates "5.0.0-beta.1" which is not unique and lower than "5.0.0-rc.1" - } + var configuration = GitFlowConfigurationBuilder.New + .WithSemanticVersionFormat(SemanticVersionFormat.Loose) + .WithNextVersion("5.0") + .WithBranch("main", + branchBuilder => branchBuilder.WithLabel("beta") + .WithIncrement(IncrementStrategy.Patch) + .WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); + + using EmptyRepositoryFixture fixture = new("main"); + fixture.Repository.MakeACommit(); + fixture.AssertFullSemver("5.0.0-beta.0", configuration); // why not "5.0.0-beta.1"? + fixture.Repository.MakeACommit(); + fixture.AssertFullSemver("5.0.0-beta.1", configuration); + fixture.Repository.MakeATaggedCommit("v5.0.0-rc.1"); + fixture.AssertFullSemver("5.0.0-rc.1", configuration); + fixture.Repository.MakeACommit(); + fixture.AssertFullSemver("5.0.1-beta.1", configuration); // test fails here, it generates "5.0.0-beta.1" which is not unique and lower than "5.0.0-rc.1" } }