Skip to content

Commit 529669c

Browse files
committed
Fixed test issues
1 parent 5af9745 commit 529669c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/FlowCommandLine/CommandLine.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,19 @@ private void ShowHelp ( List<string> parts, bool fullInfo = false ) {
360360

361361
m_commandLineProvider.WriteLine ( $" {name}{value.Description}" );
362362
}
363+
} else {
364+
ShowApplicationUsage ();
363365
}
364366
} else {
365367
if ( !parts.Any () ) return;
366368

367-
ShowApplicationUsage ();
368-
369369
var command = parts.First ();
370370
if ( m_commands.ContainsKey ( command ) || m_asyncCommands.ContainsKey ( command ) ) {
371371
m_commandLineProvider.WriteLine ( $" " );
372-
ShowHelpBySingleCommand ( parts );
372+
if (!ShowHelpBySingleCommand ( parts ) ) ShowApplicationUsage ();
373373
} else {
374+
ShowApplicationUsage ();
375+
374376
m_commandLineProvider.WriteLine ( $"{m_applicationName} version {m_applicationVersion}" );
375377
m_commandLineProvider.WriteLine ( "Command is incorrect!" );
376378
}

src/FlowCommandLineTests/CommandLineUnitTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,11 @@ public void RunCommand_NotSuccess_RequiredField () {
260260
Assert.True ( isCorrect );
261261
Assert.Equal ( "Not all required parameters is defined!", messages.First () );
262262
Assert.Equal ( " ", messages.ElementAt ( 1 ) );
263-
Assert.Equal ( "The following arguments are available:", messages.ElementAt ( 2 ) );
264-
Assert.Equal ( " --Parameter1 Description", messages.ElementAt ( 3 ) );
265-
Assert.Equal ( "The following options are available:", messages.ElementAt ( 4 ) );
266-
Assert.Equal ( " --Parameter2 Description", messages.ElementAt ( 5 ) );
263+
Assert.Equal ( "usage: test [<parameters>]", messages.ElementAt ( 2 ) );
264+
Assert.Equal ( "The following arguments are available:", messages.ElementAt ( 4 ) );
265+
Assert.Equal ( " --Parameter1 Description", messages.ElementAt ( 5 ) );
266+
Assert.Equal ( "The following options are available:", messages.ElementAt ( 6 ) );
267+
Assert.Equal ( " --Parameter2 Description", messages.ElementAt ( 7 ) );
267268
}
268269

269270
public record RunCommand_Success_QuotedParameters_Class {

0 commit comments

Comments
 (0)