mirror of
				https://github.com/Tyrrrz/CliFx.git
				synced 2025-10-25 15:19:17 +00:00 
			
		
		
		
	Cleanup
This commit is contained in:
		| @@ -223,56 +223,6 @@ public class NamedChildCommand : ICommand | ||||
|         stdErr.Should().NotBeNullOrWhiteSpace(); | ||||
|     } | ||||
|  | ||||
|     // Regression test for #117 | ||||
|     [Fact] | ||||
|     public async Task Help_text_lists_parameters_in_specified_order() | ||||
|     { | ||||
|         // Arrange | ||||
|         var commandType = DynamicCommandBuilder.Compile( | ||||
|             // language=cs | ||||
|             @" | ||||
| public abstract class CommandBase : ICommand | ||||
| { | ||||
|     [CommandParameter(0)] | ||||
|     public string Foo { get; set; } | ||||
|  | ||||
|     public abstract ValueTask ExecuteAsync(IConsole console); | ||||
| } | ||||
|  | ||||
| [Command] | ||||
| public class Command : CommandBase | ||||
| { | ||||
|     [CommandParameter(1)] | ||||
|     public string Bar { get; set; } | ||||
|      | ||||
|     [CommandParameter(2)] | ||||
|     public IReadOnlyList<string> Baz { get; set; } | ||||
|      | ||||
|     public override ValueTask ExecuteAsync(IConsole console) => default; | ||||
| } | ||||
| "); | ||||
|  | ||||
|         var application = new CliApplicationBuilder() | ||||
|             .AddCommand(commandType) | ||||
|             .UseConsole(FakeConsole) | ||||
|             .Build(); | ||||
|  | ||||
|         // Act | ||||
|         var exitCode = await application.RunAsync( | ||||
|             new[] { "--help" }, | ||||
|             new Dictionary<string, string>() | ||||
|         ); | ||||
|  | ||||
|         var stdOut = FakeConsole.ReadOutputString(); | ||||
|  | ||||
|         // Assert | ||||
|         exitCode.Should().Be(0); | ||||
|         stdOut.Should().ContainAllInOrder( | ||||
|             "USAGE", | ||||
|             "<foo>", "<bar>", "<baz...>" | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     [Fact] | ||||
|     public async Task Help_text_shows_application_metadata() | ||||
|     { | ||||
| @@ -421,6 +371,57 @@ public class Command : ICommand | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     // https://github.com/Tyrrrz/CliFx/issues/117 | ||||
|     [Fact] | ||||
|     public async Task Help_text_shows_usage_format_which_lists_all_parameters_in_specified_order() | ||||
|     { | ||||
|         // Arrange | ||||
|         var commandType = DynamicCommandBuilder.Compile( | ||||
|             // language=cs | ||||
|             @" | ||||
| // Base members appear last in reflection order | ||||
| public abstract class CommandBase : ICommand | ||||
| { | ||||
|     [CommandParameter(0)] | ||||
|     public string Foo { get; set; } | ||||
|  | ||||
|     public abstract ValueTask ExecuteAsync(IConsole console); | ||||
| } | ||||
|  | ||||
| [Command] | ||||
| public class Command : CommandBase | ||||
| { | ||||
|     [CommandParameter(2)] | ||||
|     public IReadOnlyList<string> Baz { get; set; } | ||||
|  | ||||
|     [CommandParameter(1)] | ||||
|     public string Bar { get; set; } | ||||
|      | ||||
|     public override ValueTask ExecuteAsync(IConsole console) => default; | ||||
| } | ||||
| "); | ||||
|  | ||||
|         var application = new CliApplicationBuilder() | ||||
|             .AddCommand(commandType) | ||||
|             .UseConsole(FakeConsole) | ||||
|             .Build(); | ||||
|  | ||||
|         // Act | ||||
|         var exitCode = await application.RunAsync( | ||||
|             new[] { "--help" }, | ||||
|             new Dictionary<string, string>() | ||||
|         ); | ||||
|  | ||||
|         var stdOut = FakeConsole.ReadOutputString(); | ||||
|  | ||||
|         // Assert | ||||
|         exitCode.Should().Be(0); | ||||
|         stdOut.Should().ContainAllInOrder( | ||||
|             "USAGE", | ||||
|             "<foo>", "<bar>", "<baz...>" | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     [Fact] | ||||
|     public async Task Help_text_shows_usage_format_which_lists_all_required_options() | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user