-
Notifications
You must be signed in to change notification settings - Fork 653
/
PullRequestScenarios.cs
98 lines (79 loc) · 3.77 KB
/
PullRequestScenarios.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using GitVersion.Core.Tests.Helpers;
using LibGit2Sharp;
namespace GitVersion.Core.Tests.IntegrationTests;
[TestFixture]
public class PullRequestScenarios : TestBase
{
[Test]
public void CanCalculatePullRequestChanges()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/Foo"));
fixture.Repository.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/Foo", MainBranch, normalise: true);
fixture.Repository.DumpGraph();
fixture.AssertFullSemver("0.1.1-PullRequest2.2");
}
[Test]
public void CanCalculatePullRequestChangesInheritingConfig()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
fixture.Repository.MakeACommit();
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/Foo"));
fixture.Repository.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/Foo", "develop", 44, true);
fixture.Repository.DumpGraph();
fixture.AssertFullSemver("0.2.0-PullRequest44.3");
}
[Test]
public void CanCalculatePullRequestChangesFromRemoteRepo()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/Foo"));
fixture.Repository.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/Foo", MainBranch, normalise: true);
fixture.Repository.DumpGraph();
fixture.AssertFullSemver("0.1.1-PullRequest2.2");
}
[Test]
public void CanCalculatePullRequestChangesInheritingConfigFromRemoteRepo()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
fixture.Repository.MakeACommit();
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/Foo"));
fixture.Repository.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/Foo", "develop", normalise: true);
fixture.AssertFullSemver("0.2.0-PullRequest2.3");
}
[Test]
public void CanCalculatePullRequestChangesWhenThereAreMultipleMergeCandidates()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
fixture.Repository.MakeACommit();
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("copyOfDevelop"));
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/Foo"));
fixture.Repository.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/Foo", "develop", normalise: true);
fixture.AssertFullSemver("0.2.0-PullRequest2.3");
}
[Test]
public void CalculatesCorrectVersionAfterReleaseBranchMergedToMain()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.MakeACommit("one");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("release/2.0.0"));
fixture.Repository.MakeACommit("two");
fixture.Repository.MakeACommit("three");
fixture.Repository.CreatePullRequestRef("release/2.0.0", MainBranch, normalise: true);
fixture.AssertFullSemver("2.0.0-PullRequest2.3");
}
}