Skip to content

Commit b7b189a

Browse files
committed
Fixed a few more tests and collapsed the GitFlow/GitHubFlow test folders into branch specific fixtures
1 parent fee6a2e commit b7b189a

24 files changed

+212
-369
lines changed

GitVersionCore.Tests/Fixtures/EmptyRepositoryFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System.Diagnostics;
22
using System.Text;
33
using GitVersion;
44
using GitVersion.Helpers;
@@ -23,13 +23,13 @@ public void DumpGraph()
2323
@"log --graph --abbrev-commit --decorate --date=relative --all",
2424
RepositoryPath);
2525

26-
Console.Write(output.ToString());
26+
Trace.Write(output.ToString());
2727
}
2828

2929
static IRepository CreateNewRepository(string path)
3030
{
3131
LibGit2Sharp.Repository.Init(path);
32-
Console.WriteLine("Created git repository at '{0}'", path);
32+
Trace.WriteLine("Created git repository at '{0}'", path);
3333

3434
return new Repository(path);
3535
}

GitVersionCore.Tests/GitVersionCore.Tests.csproj

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,17 @@
8181
<Compile Include="Helpers\DirectoryHelper.cs" />
8282
<Compile Include="IntegrationTests\PullRequestScenarios.cs" />
8383
<Compile Include="IntegrationTests\RemoteRepositoryTests.cs" />
84-
<Compile Include="IntegrationTests\GitFlow\DevelopScenarios.cs" />
85-
<Compile Include="IntegrationTests\GitFlow\GitFlowFeatureBranchTests.cs" />
86-
<Compile Include="IntegrationTests\GitFlow\GitFlowSupportBranchScenarios.cs" />
87-
<Compile Include="IntegrationTests\GitFlow\MetaDataByCommitScenarios.cs" />
88-
<Compile Include="IntegrationTests\GitFlow\PatchScenarios.cs" />
89-
<Compile Include="IntegrationTests\GitFlow\ReleaseBranchTests.cs" />
90-
<Compile Include="IntegrationTests\GitFlow\SwitchingToGitFlowScenarios.cs" />
91-
<Compile Include="IntegrationTests\GitFlow\UncycloScenarios.cs" />
92-
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowFeatureBranchTests.cs" />
93-
<Compile Include="IntegrationTests\GitHubFlow\OtherBranchTests.cs" />
94-
<Compile Include="IntegrationTests\GitHubFlow\ReleaseBranchTests.cs" />
84+
<Compile Include="IntegrationTests\DevelopScenarios.cs" />
85+
<Compile Include="IntegrationTests\FeatureBranchTests.cs" />
86+
<Compile Include="IntegrationTests\SupportBranchScenarios.cs" />
87+
<Compile Include="IntegrationTests\MetaDataByCommitScenarios.cs" />
88+
<Compile Include="IntegrationTests\PatchScenarios.cs" />
89+
<Compile Include="IntegrationTests\ReleaseBranchTests.cs" />
90+
<Compile Include="IntegrationTests\SwitchingToGitFlowScenarios.cs" />
91+
<Compile Include="IntegrationTests\UncycloScenarios.cs" />
92+
<Compile Include="IntegrationTests\OtherBranchTests.cs" />
9593
<Compile Include="Helpers\Constants.cs" />
9694
<Compile Include="InformationalVersionBuilderTests.cs" />
97-
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowSupportBranchScenarios.cs" />
9895
<Compile Include="JsonVersionBuilderTests.cs" />
9996
<Compile Include="Mocks\MockBranch.cs" />
10097
<Compile Include="Mocks\MockBranchCollection.cs" />
@@ -113,7 +110,7 @@
113110
<Compile Include="Fixtures\EmptyRepositoryFixture.cs" />
114111
<Compile Include="Helpers\GitTestExtensions.cs" />
115112
<Compile Include="Helpers\PathHelper.cs" />
116-
<Compile Include="IntegrationTests\GitHubFlow\MasterTests.cs" />
113+
<Compile Include="IntegrationTests\MasterTests.cs" />
117114
<Compile Include="ApprovalTestsConfig.cs" />
118115
<Compile Include="Fixtures\RepositoryFixtureBase.cs" />
119116
<Compile Include="SemanticVersionTests.cs" />
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,26 @@
33
using NUnit.Framework;
44

55
[TestFixture]
6-
public class GitHubFlowFeatureBranchTests
6+
public class FeatureBranchTests
77
{
88
[Test]
9-
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumber()
9+
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumberOffDevelop()
10+
{
11+
using (var fixture = new EmptyRepositoryFixture(new Config()))
12+
{
13+
fixture.Repository.MakeATaggedCommit("1.0.0");
14+
fixture.Repository.CreateBranch("develop");
15+
fixture.Repository.Checkout("develop");
16+
fixture.Repository.CreateBranch("feature/JIRA-123");
17+
fixture.Repository.Checkout("feature/JIRA-123");
18+
fixture.Repository.MakeCommits(5);
19+
20+
fixture.AssertFullSemver("1.1.0-JIRA-123.1+5");
21+
}
22+
}
23+
24+
[Test]
25+
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumberOffMaster()
1026
{
1127
using (var fixture = new EmptyRepositoryFixture(new Config()))
1228
{

GitVersionCore.Tests/IntegrationTests/GitFlow/GitFlowFeatureBranchTests.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

GitVersionCore.Tests/IntegrationTests/GitFlow/GitFlowSupportBranchScenarios.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.

GitVersionCore.Tests/IntegrationTests/GitHubFlow/ReleaseBranchTests.cs

Lines changed: 0 additions & 117 deletions
This file was deleted.

GitVersionCore.Tests/IntegrationTests/GitHubFlow/OtherBranchTests.cs renamed to GitVersionCore.Tests/IntegrationTests/OtherBranchTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void CanTakeVersionFromReleaseBranch()
1616
fixture.Repository.CreateBranch("alpha-2.0.0");
1717
fixture.Repository.Checkout("alpha-2.0.0");
1818

19-
fixture.AssertFullSemver("2.0.0-alpha.1+5");
19+
fixture.AssertFullSemver("2.0.0-alpha.1+0");
2020
}
2121
}
2222
}

GitVersionCore.Tests/IntegrationTests/GitFlow/PatchScenarios.cs renamed to GitVersionCore.Tests/IntegrationTests/PatchScenarios.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ public void PatchLatestReleaseExample()
1717
fixture.Repository.MakeACommit();
1818
fixture.AssertFullSemver("1.2.1-beta.1+1");
1919
fixture.Repository.ApplyTag("1.2.1-beta.1");
20-
fixture.AssertFullSemver("1.2.1-beta.1+0");
20+
fixture.AssertFullSemver("1.2.1-beta.1+1");
2121
fixture.Repository.MakeACommit();
22-
fixture.AssertFullSemver("1.2.1-beta.2+1");
22+
fixture.AssertFullSemver("1.2.1-beta.2+2");
2323

2424
// Merge hotfix branch to master
2525
fixture.Repository.Checkout("master");
2626

2727

2828
fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow());
29-
fixture.AssertFullSemver("1.2.1");
29+
fixture.AssertFullSemver("1.2.1+0");
3030

3131
fixture.Repository.ApplyTag("1.2.1");
32-
fixture.AssertFullSemver("1.2.1");
32+
fixture.AssertFullSemver("1.2.1+0");
3333

3434
// Verify develop version
3535
fixture.Repository.Checkout("develop");
36-
fixture.AssertFullSemver("1.3.0-unstable.0+0");
36+
fixture.AssertFullSemver("1.3.0-unstable.1+1");
3737

3838
fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow());
3939
fixture.AssertFullSemver("1.3.0-unstable.1+1");
@@ -50,22 +50,23 @@ public void PatchOlderReleaseExample()
5050
r.MakeATaggedCommit("1.2.0");
5151
}))
5252
{
53+
var targetCommit = ((Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target);
5354
// create hotfix branch
54-
fixture.Repository.CreateBranch("hotfix-1.1.1", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
55+
fixture.Repository.CreateBranch("hotfix-1.1.1", targetCommit).Checkout();
5556

5657
fixture.AssertFullSemver("1.1.1-beta.1+0");
5758
fixture.Repository.MakeACommit();
5859
fixture.AssertFullSemver("1.1.1-beta.1+1");
5960

6061
// Merge hotfix branch to support
61-
fixture.Repository.CreateBranch("support-1.2", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
62-
fixture.AssertFullSemver("1.1.0");
62+
fixture.Repository.CreateBranch("support-1.1", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
63+
fixture.AssertFullSemver("1.1.0+0");
6364

6465
fixture.Repository.MergeNoFF("hotfix-1.1.1", Constants.SignatureNow());
65-
fixture.AssertFullSemver("1.1.1");
66+
fixture.AssertFullSemver("1.1.1+0");
6667

6768
fixture.Repository.ApplyTag("1.1.1");
68-
fixture.AssertFullSemver("1.1.1");
69+
fixture.AssertFullSemver("1.1.1+0");
6970

7071
// Verify develop version
7172
fixture.Repository.Checkout("develop");

0 commit comments

Comments
 (0)