|
1 |
| -using System.Collections.Generic; |
2 | 1 | using System.Linq;
|
3 | 2 | using FluentDate;
|
4 | 3 | using FluentDateTimeOffset;
|
|
9 | 8 | [TestFixture]
|
10 | 9 | public class LibGitExtensionsTests
|
11 | 10 | {
|
12 |
| - [Test] |
13 |
| - public void NewestSemVerTag_RetrieveTheHighestSemanticVersionPointingAtTheSpecifiedCommit() |
14 |
| - { |
15 |
| - var mockCommit = new MockCommit(); |
16 |
| - var repo = new MockRepository |
17 |
| - { |
18 |
| - Tags = new MockTagCollection |
19 |
| - { |
20 |
| - Tags = new List<Tag> |
21 |
| - { |
22 |
| - new MockTag |
23 |
| - { |
24 |
| - NameEx = "a", |
25 |
| - TargetEx = mockCommit, |
26 |
| - AnnotationEx = new MockTagAnnotation |
27 |
| - { |
28 |
| - TaggerEx = new Signature("a", "", 7.Seconds().Ago()) |
29 |
| - } |
30 |
| - }, |
31 |
| - new MockTag |
32 |
| - { |
33 |
| - NameEx = "9.0.0a", |
34 |
| - TargetEx = mockCommit, |
35 |
| - AnnotationEx = new MockTagAnnotation |
36 |
| - { |
37 |
| - TaggerEx = new Signature("a", "", 5.Seconds().Ago()) |
38 |
| - } |
39 |
| - }, |
40 |
| - new MockTag |
41 |
| - { |
42 |
| - NameEx = "0.1.0", |
43 |
| - TargetEx = mockCommit, |
44 |
| - AnnotationEx = new MockTagAnnotation |
45 |
| - { |
46 |
| - TaggerEx = new Signature("a", "", 1.Seconds().Ago()) |
47 |
| - } |
48 |
| - }, |
49 |
| - new MockTag |
50 |
| - { |
51 |
| - NameEx = "0.2.0", |
52 |
| - TargetEx = mockCommit, |
53 |
| - AnnotationEx = new MockTagAnnotation |
54 |
| - { |
55 |
| - TaggerEx = new Signature("a", "", 5.Seconds().Ago()) |
56 |
| - } |
57 |
| - }, |
58 |
| - } |
59 |
| - } |
60 |
| - }; |
61 |
| - |
62 |
| - var version = repo.NewestSemVerTag(mockCommit); |
63 |
| - |
64 |
| - Assert.AreEqual(0, version.Major); |
65 |
| - Assert.AreEqual(1, version.Minor); |
66 |
| - Assert.AreEqual(0, version.Patch); |
67 |
| - } |
68 |
| - |
69 |
| - [Test] |
70 |
| - public void NewestSemVerTag_ReturnNullWhenNoTagPointingAtTheSpecifiedCommitHasBeenFound() |
71 |
| - { |
72 |
| - var tagNames = new[] { "a", "9.0.0", "z", "0.1.0", "11.1.0", "0.2.0" }; |
73 |
| - |
74 |
| - var col = new MockTagCollection(); |
75 |
| - foreach (var tagName in tagNames) |
76 |
| - { |
77 |
| - col.Add(new MockTag |
78 |
| - { |
79 |
| - NameEx = tagName, |
80 |
| - TargetEx = null, |
81 |
| - AnnotationEx = new MockTagAnnotation |
82 |
| - { |
83 |
| - TaggerEx = new Signature("a", "", 5.Seconds().Ago()) |
84 |
| - } |
85 |
| - }); |
86 |
| - } |
87 |
| - |
88 |
| - var repo = new MockRepository { Tags = col }; |
89 |
| - |
90 |
| - var version = repo.NewestSemVerTag(new MockCommit()); |
91 |
| - |
92 |
| - Assert.IsNull(version); |
93 |
| - } |
94 | 11 |
|
95 | 12 | [Test]
|
96 | 13 | public void TagsByDate_HonorChainedAnnotatedTags()
|
|
0 commit comments