diff --git a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.cs b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.cs index 091ad2af9..7004c8ffe 100644 --- a/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.cs +++ b/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.cs @@ -160,55 +160,6 @@ public void Should_Pass_Case_6() }); } - [Fact] - public void Should_Pass_Case_7() - { - // Given - var app = new CommandAppTester(); - app.Configure(cfg => - { - cfg.AddBranch("a", d => - { - d.AddDelegate("b", _ => - { - AnsiConsole.MarkupLine("[red]Complete[/]"); - return 0; - }); - }); - }); - - // When - var result = app.Run([ - "a", "b" - ]); - - // Then - result.ExitCode.ShouldBe(0); - } - - [Fact] - public void Should_Pass_Case_8() - { - // Given - var app = new CommandAppTester(); - app.Configure(cfg => - { - cfg.AddDelegate("a", _ => - { - AnsiConsole.MarkupLine("[red]Complete[/]"); - return 0; - }); - }); - - // When - var result = app.Run([ - "a" - ]); - - // Then - result.ExitCode.ShouldBe(0); - } - [Fact] public void Should_Pass_Case_3() { @@ -1185,6 +1136,55 @@ public void Should_Execute_Delegate_Command_At_Root_Level() data.ShouldBe(2); } + [Fact] + public void Should_Execute_Nested_Delegate_Empty_Command() + { + // Given + var app = new CommandAppTester(); + app.Configure(cfg => + { + cfg.AddBranch("a", d => + { + d.AddDelegate("b", _ => + { + AnsiConsole.MarkupLine("[red]Complete[/]"); + return 0; + }); + }); + }); + + // When + var result = app.Run([ + "a", "b" + ]); + + // Then + result.ExitCode.ShouldBe(0); + } + + [Fact] + public void Should_Execute_Delegate_Empty_Command_At_Root_Level() + { + // Given + var app = new CommandAppTester(); + app.Configure(cfg => + { + cfg.AddDelegate("a", _ => + { + AnsiConsole.MarkupLine("[red]Complete[/]"); + return 0; + }); + }); + + // When + var result = app.Run([ + "a" + ]); + + // Then + result.ExitCode.ShouldBe(0); + } + [Fact] public async void Should_Execute_Async_Delegate_Command_At_Root_Level() {