-
Notifications
You must be signed in to change notification settings - Fork 653
/
Copy pathBranchWithoutCommitScenarios.cs
40 lines (33 loc) · 1.33 KB
/
BranchWithoutCommitScenarios.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
using GitTools.Testing;
using GitVersionCore.Tests.Helpers;
using LibGit2Sharp;
using NUnit.Framework;
namespace GitVersionCore.Tests.IntegrationTests
{
[TestFixture]
public class BranchWithoutCommitScenarios : TestBase
{
[Test]
public void CanTakeVersionFromReleaseBranch()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("1.0.3");
var commit = fixture.Repository.MakeACommit();
fixture.Repository.CreateBranch("release-4.0.123");
fixture.Checkout(commit.Sha);
fixture.AssertFullSemver("4.0.123-beta.1+0", null, fixture.Repository, commit.Sha, onlyTrackedBranches: false, targetBranch: "release-4.0.123");
}
[Test]
public void BranchVersionHavePrecedenceOverTagVersionIfVersionGreaterThanTag()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.Repository.CreateBranch("develop");
fixture.Checkout("develop");
fixture.MakeATaggedCommit("0.1.0-alpha.1"); // simulate merge from feature branch
fixture.Repository.CreateBranch("release/1.0");
fixture.Checkout("release/1.0");
fixture.AssertFullSemver("1.0.0-beta.1+0");
}
}
}