@@ -16,7 +16,7 @@ public void RunCommand_Success_Empty_ShowHelp () {
1616 var commandLine = new CommandLine ( fakeProvider ) ;
1717
1818 //act
19- commandLine
19+ var result = commandLine
2020 . Application ( "TestApplication" , "1.0.0" )
2121 . RunCommand ( ) ;
2222
@@ -25,6 +25,9 @@ public void RunCommand_Success_Empty_ShowHelp () {
2525 Assert . Equal ( 2 , messages . Count ) ;
2626 Assert . Equal ( "TestApplication version 1.0.0" , messages . First ( ) ) ;
2727 Assert . Equal ( " " , messages . ElementAt ( 1 ) ) ;
28+ Assert . True ( result . EmptyInput ) ;
29+ Assert . False ( result . Handled ) ;
30+ Assert . False ( result . CommandHandled ) ;
2831 }
2932
3033 [ Fact ]
@@ -37,7 +40,33 @@ public void RunCommand_Success_OnlyDescription_ShowHelp () {
3740 var commandLine = new CommandLine ( fakeProvider ) ;
3841
3942 //act
40- commandLine
43+ var result = commandLine
44+ . Application ( "TestApplication" , "1.0.0" , "Application description!!!!" )
45+ . RunCommand ( ) ;
46+
47+ //assert
48+ Assert . NotEmpty ( messages ) ;
49+ Assert . Equal ( 4 , messages . Count ) ;
50+ Assert . Equal ( "TestApplication version 1.0.0" , messages . First ( ) ) ;
51+ Assert . Equal ( " " , messages . ElementAt ( 1 ) ) ;
52+ Assert . Equal ( "Application description!!!!" , messages . ElementAt ( 2 ) ) ;
53+ Assert . Equal ( " " , messages . ElementAt ( 3 ) ) ;
54+ Assert . True ( result . EmptyInput ) ;
55+ Assert . False ( result . Handled ) ;
56+ Assert . False ( result . CommandHandled ) ;
57+ }
58+
59+ [ Fact ]
60+ public void RunCommand_Success_OnlyDescription_ShowHelp_Parameter ( ) {
61+ //arrange
62+ var messages = new List < string > ( ) ;
63+ var fakeProvider = A . Fake < ICommandLineProvider > ( ) ;
64+ A . CallTo ( ( ) => fakeProvider . GetCommandLine ( ) ) . Returns ( "--help" ) ;
65+ A . CallTo ( ( ) => fakeProvider . WriteLine ( A < string > . _ ) ) . Invokes ( ( string fake ) => { messages . Add ( fake ) ; } ) ;
66+ var commandLine = new CommandLine ( fakeProvider ) ;
67+
68+ //act
69+ var result = commandLine
4170 . Application ( "TestApplication" , "1.0.0" , "Application description!!!!" )
4271 . RunCommand ( ) ;
4372
@@ -48,6 +77,9 @@ public void RunCommand_Success_OnlyDescription_ShowHelp () {
4877 Assert . Equal ( " " , messages . ElementAt ( 1 ) ) ;
4978 Assert . Equal ( "Application description!!!!" , messages . ElementAt ( 2 ) ) ;
5079 Assert . Equal ( " " , messages . ElementAt ( 3 ) ) ;
80+ Assert . False ( result . EmptyInput ) ;
81+ Assert . True ( result . Handled ) ;
82+ Assert . False ( result . CommandHandled ) ;
5183 }
5284
5385 [ Fact ]
@@ -60,7 +92,7 @@ public void RunCommand_Success_OnlyExecutable_ShowHelp () {
6092 var commandLine = new CommandLine ( fakeProvider ) ;
6193
6294 //act
63- commandLine
95+ var result = commandLine
6496 . Application ( "TestApplication" , "1.0.0" , applicationExecutable : "testapp" )
6597 . RunCommand ( ) ;
6698
@@ -71,6 +103,9 @@ public void RunCommand_Success_OnlyExecutable_ShowHelp () {
71103 Assert . Equal ( " " , messages . ElementAt ( 1 ) ) ;
72104 Assert . Equal ( "usage: testapp [<command>] [<parameters>]" , messages . ElementAt ( 2 ) ) ;
73105 Assert . Equal ( " " , messages . ElementAt ( 3 ) ) ;
106+ Assert . True ( result . EmptyInput ) ;
107+ Assert . False ( result . Handled ) ;
108+ Assert . False ( result . CommandHandled ) ;
74109 }
75110
76111 public record RunCommand_Success_OnlyCommands_ShowHelp_Class { }
@@ -120,7 +155,7 @@ public void RunCommand_Success_OnlyCommands_SingleCommand () {
120155 var isCorrect = false ;
121156
122157 //act
123- commandLine
158+ var result = commandLine
124159 . Application ( "TestApplication" , "1.0.0" )
125160 . AddCommand (
126161 "test" ,
@@ -140,6 +175,9 @@ public void RunCommand_Success_OnlyCommands_SingleCommand () {
140175
141176 //assert
142177 Assert . True ( isCorrect ) ;
178+ Assert . False ( result . EmptyInput ) ;
179+ Assert . False ( result . Handled ) ;
180+ Assert . True ( result . CommandHandled ) ;
143181 }
144182
145183 public record RunCommand_Success_IntLongDoubleFloatTypes_Class {
@@ -1144,7 +1182,7 @@ public void RunOptions_Success_ComplexParameters () {
11441182 "" ,
11451183 databaseAdjustments
11461184 )
1147- . RunCommand ( ) ;
1185+ . RunCommand ( ) ;
11481186
11491187 //assert
11501188 Assert . NotNull ( result ) ;
0 commit comments