22using System . Linq ;
33using System . Threading ;
44
5- using MatthiWare . CommandLine ;
65using MatthiWare . CommandLine . Abstractions ;
76using MatthiWare . CommandLine . Abstractions . Command ;
87using MatthiWare . CommandLine . Abstractions . Models ;
@@ -59,7 +58,7 @@ public void CommandLineParserUsesContainerCorrectly()
5958
6059 var result = parser . Parse ( new [ ] { "app.exe" , "my" } ) ;
6160
62- Assert . False ( result . HasErrors ) ;
61+ result . AssertNoErrors ( ) ;
6362
6463 commandMock . VerifyAll ( ) ;
6564 containerMock . VerifyAll ( ) ;
@@ -148,7 +147,7 @@ public void CommandLineParserUsesArgumentFactoryCorrectly()
148147
149148 var result = parser . Parse ( new [ ] { "app.exe" , "-m" } ) ;
150149
151- Assert . False ( result . HasErrors ) ;
150+ result . AssertNoErrors ( ) ;
152151
153152 resolverMock . VerifyAll ( ) ;
154153 argResolverFactory . Verify ( ) ;
@@ -168,7 +167,7 @@ public void ParseTests()
168167
169168 Assert . NotNull ( parsed ) ;
170169
171- Assert . False ( parsed . HasErrors ) ;
170+ parsed . AssertNoErrors ( ) ;
172171
173172 Assert . Equal ( "test" , parsed . Result . Option1 ) ;
174173 }
@@ -222,9 +221,7 @@ public void ParseWithDefaults(string[] args, string result1, string result2, str
222221
223222 var parsed = parser . Parse ( args ) ;
224223
225- Assert . NotNull ( parsed ) ;
226-
227- Assert . False ( parsed . HasErrors ) ;
224+ parsed . AssertNoErrors ( ) ;
228225
229226 Assert . Equal ( result1 , parsed . Result . Option1 ) ;
230227 Assert . Equal ( result2 , parsed . Result . Option2 ) ;
@@ -246,7 +243,7 @@ public void ParseWithCustomParserInAttributeConfiguredModelTests()
246243
247244 var result = parser . Parse ( new [ ] { "app.exe" , "-p" , "sample" } ) ;
248245
249- Assert . False ( result . HasErrors ) ;
246+ result . AssertNoErrors ( ) ;
250247
251248 Assert . Same ( obj , result . Result . Param ) ;
252249 }
@@ -278,9 +275,7 @@ public void ParseWithCommandTests()
278275
279276 var parsed = parser . Parse ( new string [ ] { "app.exe" , "-o" , "test" , "add" , "-m" , "my message" } ) ;
280277
281- Assert . False ( parsed . HasErrors ) ;
282-
283- Assert . NotNull ( parsed ) ;
278+ parsed . AssertNoErrors ( ) ;
284279
285280 Assert . Equal ( "test" , parsed . Result . Option1 ) ;
286281
@@ -318,7 +313,7 @@ public void ParseCommandTests(string[] args, string result1, string result2)
318313
319314 var result = parser . Parse ( args ) ;
320315
321- Assert . False ( result . HasErrors ) ;
316+ result . AssertNoErrors ( ) ;
322317
323318 Assert . Equal ( result1 , result . Result . Message ) ;
324319
@@ -335,16 +330,14 @@ public void BoolResolverSpecialCaseParsesCorrectly(string[] args, bool expected)
335330 {
336331 var parser = new CommandLineParser < Options > ( ) ;
337332
338- //parser.Configure(opt => opt.Option1)
339- // .Name("o", "opt")
340- // .Default("Default message");
341-
342333 parser . Configure ( opt => opt . Option2 )
343334 . Name ( "x" , "xsomething" )
344335 . Required ( ) ;
345336
346337 var result = parser . Parse ( args ) ;
347338
339+ result . AssertNoErrors ( ) ;
340+
348341 Assert . Equal ( expected , result . Result . Option2 ) ;
349342 }
350343
0 commit comments