11using AET . ModVerify . App . Settings . CommandLine ;
2+ using AET . ModVerify . Reporting ;
23using AnakinRaW . ApplicationBase . Environment ;
34using System ;
45using System . IO . Abstractions ;
@@ -211,4 +212,73 @@ public void Parse_CreateBaseline_MissingRequired_Fails(string argString)
211212 Assert . Null ( settings . ModVerifyOptions ) ;
212213 Assert . Null ( settings . UpdateOptions ) ;
213214 }
215+
216+ [ Theory ]
217+ [ InlineData ( "verify --mods myMod --baseline myBaseline.json" , "myBaseline.json" , false , false ) ]
218+ [ InlineData ( "verify --mods myMod --searchBaseline" , null , true , false ) ]
219+ [ InlineData ( "verify --path myMod --useDefaultBaseline" , null , false , true ) ]
220+ public void Parse_Verify_BaselineOptions ( string argString , string ? expectedBaseline , bool expectedSearchBaseline , bool expectedUseDefaultBaseline )
221+ {
222+ var settings = Parser . Parse ( argString . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ) ;
223+
224+ Assert . True ( settings . HasOptions ) ;
225+ var verify = Assert . IsType < VerifyVerbOption > ( settings . ModVerifyOptions ) ;
226+ Assert . Equal ( expectedBaseline , verify . Baseline ) ;
227+ Assert . Equal ( expectedSearchBaseline , verify . SearchBaselineLocally ) ;
228+ Assert . Equal ( expectedUseDefaultBaseline , verify . UseDefaultBaseline ) ;
229+ }
230+
231+ [ Fact ]
232+ public void Parse_Verify_Baseline_And_SearchBaseline_CanBeParsedTogether ( )
233+ {
234+ // Mutual exclusivity of --baseline and --searchBaseline is enforced later by SettingsBuilder, not by the parser.
235+ const string argString = "verify --mods myMod --baseline myBaseline.json --searchBaseline" ;
236+
237+ var settings = Parser . Parse ( argString . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ) ;
238+
239+ Assert . True ( settings . HasOptions ) ;
240+ var verify = Assert . IsType < VerifyVerbOption > ( settings . ModVerifyOptions ) ;
241+ Assert . Equal ( "myBaseline.json" , verify . Baseline ) ;
242+ Assert . True ( verify . SearchBaselineLocally ) ;
243+ }
244+
245+ [ Theory ]
246+ [ InlineData ( "verify --path myMod --outDir myOut" , "myOut" ) ]
247+ [ InlineData ( "verify --path myMod -o myOut" , "myOut" ) ]
248+ [ InlineData ( "verify --path myMod" , null ) ]
249+ public void Parse_Verify_OutputDirectory ( string argString , string ? expectedOutDir )
250+ {
251+ var settings = Parser . Parse ( argString . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ) ;
252+
253+ Assert . True ( settings . HasOptions ) ;
254+ var verify = Assert . IsType < VerifyVerbOption > ( settings . ModVerifyOptions ) ;
255+ Assert . Equal ( expectedOutDir , verify . OutputDirectory ) ;
256+ }
257+
258+ [ Theory ]
259+ [ InlineData ( "verify --path myMod --failFast --minFailSeverity Critical" , true , "Critical" ) ]
260+ [ InlineData ( "verify --path myMod --failFast --minFailSeverity Warning" , true , "Warning" ) ]
261+ [ InlineData ( "verify --path myMod" , false , null ) ]
262+ public void Parse_Verify_FailFastOptions ( string argString , bool expectedFailFast , string ? expectedMinSeverity )
263+ {
264+ var settings = Parser . Parse ( argString . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ) ;
265+
266+ Assert . True ( settings . HasOptions ) ;
267+ var verify = Assert . IsType < VerifyVerbOption > ( settings . ModVerifyOptions ) ;
268+ Assert . Equal ( expectedFailFast , verify . FailFast ) ;
269+ var expectedSeverity = expectedMinSeverity is null ? ( VerificationSeverity ? ) null : Enum . Parse < VerificationSeverity > ( expectedMinSeverity ) ;
270+ Assert . Equal ( expectedSeverity , verify . MinimumFailureSeverity ) ;
271+ }
272+
273+ [ Theory ]
274+ [ InlineData ( "verify --path myMod --ignoreAsserts" , true ) ]
275+ [ InlineData ( "verify --path myMod" , false ) ]
276+ public void Parse_Verify_IgnoreAsserts ( string argString , bool expectedIgnoreAsserts )
277+ {
278+ var settings = Parser . Parse ( argString . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ) ;
279+
280+ Assert . True ( settings . HasOptions ) ;
281+ var verify = Assert . IsType < VerifyVerbOption > ( settings . ModVerifyOptions ) ;
282+ Assert . Equal ( expectedIgnoreAsserts , verify . IgnoreAsserts ) ;
283+ }
214284}
0 commit comments