@@ -85,6 +85,23 @@ public void GivenARepositoryWithTagAndANextVersionTxtFile_VersionShouldMatchVers
85
85
}
86
86
}
87
87
88
+ [ Fact ]
89
+ public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommits_VersionShouldBeTag ( )
90
+ {
91
+ using ( var fixture = new EmptyRepositoryFixture ( ) )
92
+ {
93
+ const string ExpectedNextVersion = "1.1.0" ;
94
+ const string TaggedVersion = "1.0.3" ;
95
+ fixture . Repository . MakeATaggedCommit ( TaggedVersion ) ;
96
+ fixture . Repository . AddNextVersionTxtFile ( ExpectedNextVersion ) ;
97
+
98
+ var result = fixture . ExecuteGitVersion ( ) ;
99
+
100
+ result . ExitCode . ShouldBe ( 0 ) ;
101
+ result . OutputVariables [ VariableProvider . FullSemVer ] . ShouldBe ( "1.0.3+0" ) ;
102
+ }
103
+ }
104
+
88
105
[ Fact ]
89
106
public void GivenARepositoryWithTagAndNoNextVersionTxtFile_VersionShouldBeTagWithBumpedPatch ( )
90
107
{
@@ -101,6 +118,21 @@ public void GivenARepositoryWithTagAndNoNextVersionTxtFile_VersionShouldBeTagWit
101
118
}
102
119
}
103
120
121
+ [ Fact ]
122
+ public void GivenARepositoryWithTagAndNoNextVersionTxtFileAndNoCommits_VersionShouldBeTag ( )
123
+ {
124
+ using ( var fixture = new EmptyRepositoryFixture ( ) )
125
+ {
126
+ const string TaggedVersion = "1.0.3" ;
127
+ fixture . Repository . MakeATaggedCommit ( TaggedVersion ) ;
128
+
129
+ var result = fixture . ExecuteGitVersion ( ) ;
130
+
131
+ result . ExitCode . ShouldBe ( 0 ) ;
132
+ result . OutputVariables [ VariableProvider . FullSemVer ] . ShouldBe ( "1.0.3+0" ) ;
133
+ }
134
+ }
135
+
104
136
[ Fact ]
105
137
public void GivenARepositoryWithTagAndOldNextVersionTxtFile_VersionShouldBeTagWithBumpedPatch ( )
106
138
{
@@ -118,5 +150,22 @@ public void GivenARepositoryWithTagAndOldNextVersionTxtFile_VersionShouldBeTagWi
118
150
result . OutputVariables [ VariableProvider . FullSemVer ] . ShouldBe ( "1.1.1+5" ) ;
119
151
}
120
152
}
153
+
154
+ [ Fact ]
155
+ public void GivenARepositoryWithTagAndOldNextVersionTxtFileAndNoCommits_VersionShouldBeTag ( )
156
+ {
157
+ using ( var fixture = new EmptyRepositoryFixture ( ) )
158
+ {
159
+ const string NextVersionTxt = "1.0.0" ;
160
+ const string TaggedVersion = "1.1.0" ;
161
+ fixture . Repository . MakeATaggedCommit ( TaggedVersion ) ;
162
+ fixture . Repository . AddNextVersionTxtFile ( NextVersionTxt ) ;
163
+
164
+ var result = fixture . ExecuteGitVersion ( ) ;
165
+
166
+ result . ExitCode . ShouldBe ( 0 ) ;
167
+ result . OutputVariables [ VariableProvider . FullSemVer ] . ShouldBe ( "1.1.0+0" ) ;
168
+ }
169
+ }
121
170
}
122
171
}
0 commit comments