@@ -155,14 +155,16 @@ public void UsernameAndPasswordCanBeParsed()
155
155
public void UnknownOutputShouldThrow ( )
156
156
{
157
157
var exception = Assert . Throws < WarningException > ( ( ) => argumentParser . ParseArguments ( "targetDirectoryPath -output invalid_value" ) ) ;
158
- exception . Message . ShouldBe ( "Value 'invalid_value' cannot be parsed as output type, please use 'json' or 'buildserver'" ) ;
158
+ exception . Message . ShouldBe ( "Value 'invalid_value' cannot be parsed as output type, please use 'json', 'file' or 'buildserver'" ) ;
159
159
}
160
160
161
161
[ Test ]
162
162
public void OutputDefaultsToJson ( )
163
163
{
164
164
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath" ) ;
165
165
arguments . Output . ShouldContain ( OutputType . Json ) ;
166
+ arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
167
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
166
168
}
167
169
168
170
[ Test ]
@@ -171,6 +173,7 @@ public void OutputJsonCanBeParsed()
171
173
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output json" ) ;
172
174
arguments . Output . ShouldContain ( OutputType . Json ) ;
173
175
arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
176
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
174
177
}
175
178
176
179
[ Test ]
@@ -179,6 +182,7 @@ public void MultipleOutputJsonCanBeParsed()
179
182
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output json -output json" ) ;
180
183
arguments . Output . ShouldContain ( OutputType . Json ) ;
181
184
arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
185
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
182
186
}
183
187
184
188
[ Test ]
@@ -187,6 +191,7 @@ public void OutputBuildserverCanBeParsed()
187
191
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver" ) ;
188
192
arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
189
193
arguments . Output . ShouldNotContain ( OutputType . Json ) ;
194
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
190
195
}
191
196
192
197
[ Test ]
@@ -195,6 +200,25 @@ public void MultipleOutputBuildserverCanBeParsed()
195
200
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver -output buildserver" ) ;
196
201
arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
197
202
arguments . Output . ShouldNotContain ( OutputType . Json ) ;
203
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
204
+ }
205
+
206
+ [ Test ]
207
+ public void OutputFileCanBeParsed ( )
208
+ {
209
+ var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output file" ) ;
210
+ arguments . Output . ShouldContain ( OutputType . File ) ;
211
+ arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
212
+ arguments . Output . ShouldNotContain ( OutputType . Json ) ;
213
+ }
214
+
215
+ [ Test ]
216
+ public void MultipleOutputFileCanBeParsed ( )
217
+ {
218
+ var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output file -output file" ) ;
219
+ arguments . Output . ShouldContain ( OutputType . File ) ;
220
+ arguments . Output . ShouldNotContain ( OutputType . BuildServer ) ;
221
+ arguments . Output . ShouldNotContain ( OutputType . Json ) ;
198
222
}
199
223
200
224
[ Test ]
@@ -203,6 +227,16 @@ public void OutputBuildserverAndJsonCanBeParsed()
203
227
var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver -output json" ) ;
204
228
arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
205
229
arguments . Output . ShouldContain ( OutputType . Json ) ;
230
+ arguments . Output . ShouldNotContain ( OutputType . File ) ;
231
+ }
232
+
233
+ [ Test ]
234
+ public void OutputBuildserverAndJsonAndFileCanBeParsed ( )
235
+ {
236
+ var arguments = argumentParser . ParseArguments ( "targetDirectoryPath -output buildserver -output json -output file" ) ;
237
+ arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
238
+ arguments . Output . ShouldContain ( OutputType . Json ) ;
239
+ arguments . Output . ShouldContain ( OutputType . File ) ;
206
240
}
207
241
208
242
[ Test ]
@@ -212,6 +246,16 @@ public void MultipleArgsAndFlag()
212
246
arguments . Output . ShouldContain ( OutputType . BuildServer ) ;
213
247
}
214
248
249
+ [ TestCase ( "-output file" , "GitVersion.json" ) ]
250
+ [ TestCase ( "-output file -outputfile version.json" , "version.json" ) ]
251
+ public void OutputFileArgumentCanBeParsed ( string args , string outputFile )
252
+ {
253
+ var arguments = argumentParser . ParseArguments ( args ) ;
254
+
255
+ arguments . Output . ShouldContain ( OutputType . File ) ;
256
+ arguments . OutputFile . ShouldBe ( outputFile ) ;
257
+ }
258
+
215
259
[ Test ]
216
260
public void UrlAndBranchNameCanBeParsed ( )
217
261
{
0 commit comments