예제 #1
0
        public async Task ConsoleOptionsFromRunAreUsed()
        {
            var console = new TestConsole();

            console.AddLinesToRead("x");

            var app = new TestConsoleApp(console, new ConsoleOptions {
                AlwaysDisplayCommands = false
            });
            await app.RunAsync(new ConsoleOptions { AlwaysDisplayCommands = true });

            Assert.True(console.Options.AlwaysDisplayCommands);
        }
예제 #2
0
        public async Task DoesntShowTheHelpCommandWhenAlwaysDisplayingCommands()
        {
            var console = new TestConsole();

            console.AddLinesToRead("x");

            var app = new TestConsoleApp(console, new ConsoleOptions {
                AlwaysDisplayCommands = true
            });
            await app.RunAsync();

            console.HasOutput(@"
[x|exit] Exit the application
> x

");
        }
예제 #3
0
        public async Task ShowsTheHelpCommandWhenNotAlwaysDisplayingCommands()
        {
            var console = new TestConsole();

            console.AddLinesToRead("x");

            var app = new TestConsoleApp(console, new ConsoleOptions {
                AlwaysDisplayCommands = false
            });
            await app.RunAsync();

            console.HasOutput(@"
[?|help] Display available commands
[x|exit] Exit the application
> x

");
        }
예제 #4
0
        public async Task AppCommandsAreShownAfterHelpAndBeforeExit()
        {
            var console = new TestConsole();

            console.AddLinesToRead("x");

            var app = new TestConsoleApp(console, new ConsoleOptions {
                AlwaysDisplayCommands = false
            })
                      .WithCommand("A", () => { });
            await app.RunAsync();

            console.HasOutput(@"
[?|help] Display available commands
[A] Command for A
[x|exit] Exit the application
> x

");
        }