-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathBranchTests.cs
More file actions
47 lines (43 loc) · 1.57 KB
/
BranchTests.cs
File metadata and controls
47 lines (43 loc) · 1.57 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
using System.Linq;
using SourceGit.Models;
using Xunit;
namespace SourceGit.Tests.Models
{
public class BranchTests
{
private static Branch MakeBranch(int ahead, int behind) => new()
{
Ahead = Enumerable.Repeat("x", ahead).ToList(),
Behind = Enumerable.Repeat("x", behind).ToList(),
};
[Theory]
[InlineData("main", "origin", true, "main")]
[InlineData("main", "origin", false, "origin/main")]
[InlineData("feature", "upstream", false, "upstream/feature")]
public void FriendlyName_ReturnsExpected(string name, string remote, bool isLocal, string expected)
{
var branch = new Branch { Name = name, Remote = remote, IsLocal = isLocal };
Assert.Equal(expected, branch.FriendlyName);
}
[Theory]
[InlineData(0, 0, false)]
[InlineData(1, 0, true)]
[InlineData(0, 1, true)]
[InlineData(1, 1, true)]
public void IsTrackStatusVisible_ReturnsExpected(int ahead, int behind, bool expected)
{
Assert.Equal(expected, MakeBranch(ahead, behind).IsTrackStatusVisible);
}
[Theory]
[InlineData(0, 0, "")]
[InlineData(3, 0, "3↑")]
[InlineData(0, 2, "2↓")]
[InlineData(3, 2, "3↑ 2↓")]
[InlineData(1, 0, "1↑")]
[InlineData(0, 1, "1↓")]
public void TrackStatusDescription_ReturnsExpected(int ahead, int behind, string expected)
{
Assert.Equal(expected, MakeBranch(ahead, behind).TrackStatusDescription);
}
}
}