-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathGitFlowTests.cs
More file actions
79 lines (70 loc) · 2.13 KB
/
GitFlowTests.cs
File metadata and controls
79 lines (70 loc) · 2.13 KB
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
using SourceGit.Models;
using Xunit;
namespace SourceGit.Tests.Models
{
public class GitFlowTests
{
private static GitFlow FullyConfigured() => new()
{
Master = "main",
Develop = "develop",
FeaturePrefix = "feature/",
ReleasePrefix = "release/",
HotfixPrefix = "hotfix/",
};
[Fact]
public void IsValid_ReturnsTrue_WhenAllFieldsAreSet()
{
Assert.True(FullyConfigured().IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenMasterIsEmpty()
{
var gf = FullyConfigured();
gf.Master = "";
Assert.False(gf.IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenDevelopIsEmpty()
{
var gf = FullyConfigured();
gf.Develop = "";
Assert.False(gf.IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenFeaturePrefixIsEmpty()
{
var gf = FullyConfigured();
gf.FeaturePrefix = "";
Assert.False(gf.IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenReleasePrefixIsEmpty()
{
var gf = FullyConfigured();
gf.ReleasePrefix = "";
Assert.False(gf.IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenHotfixPrefixIsEmpty()
{
var gf = FullyConfigured();
gf.HotfixPrefix = "";
Assert.False(gf.IsValid);
}
[Fact]
public void IsValid_ReturnsFalse_WhenAllFieldsAreEmpty()
{
Assert.False(new GitFlow().IsValid);
}
[Theory]
[InlineData(GitFlowBranchType.Feature, "feature/")]
[InlineData(GitFlowBranchType.Release, "release/")]
[InlineData(GitFlowBranchType.Hotfix, "hotfix/")]
[InlineData(GitFlowBranchType.None, "")]
public void GetPrefix_ReturnsExpectedPrefix(GitFlowBranchType type, string expected)
{
Assert.Equal(expected, FullyConfigured().GetPrefix(type));
}
}
}