Ejemplo n.º 1
0
        public void WhenHittingEscapeOnCommand_AssertCommandNameCleared()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('\u0027', ConsoleKey.Escape, false, false, false),

                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.Command.ShouldBeNull();
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.ShouldBeEmpty();
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 2
0
        public void WhenCommandEnteredAndTabbingForParam_AssertParamShowed()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),

                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeTrue();
            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.Single().Parameter.Name.ShouldBe("Param1");
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 3
0
        public void WhenHittingEscapeOnParameterName_AssertParameterNameCleared()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),

                new ConsoleKeyInfo('-', ConsoleKey.OemMinus, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('b', ConsoleKey.B, false, false, false),
                new ConsoleKeyInfo('c', ConsoleKey.C, false, false, false),
                new ConsoleKeyInfo('\u0027', ConsoleKey.Escape, false, false, false),

                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.ShouldBeEmpty();
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 4
0
        public void WhenBackspacePressedManyTimes_AssertTextEmpty()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 5
0
        public void WhenParsingInput_AssertDirectResult()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),

                new ConsoleKeyInfo('-', ConsoleKey.OemMinus, false, false, false),
                new ConsoleKeyInfo('t', ConsoleKey.T, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeTrue();
            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.ShouldBeEmpty();
            result.RemainingText.ShouldBe("-t");
        }
Ejemplo n.º 6
0
        public void WhenHittingEnterWithNothingEnteredIntoLine_AssertNotValid()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeFalse();
        }
Ejemplo n.º 7
0
        public void WhenParsingTabbedInputMultipleTimes_AssertTabResult()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),

                new ConsoleKeyInfo('-', ConsoleKey.OemMinus, false, false, false),
                new ConsoleKeyInfo('p', ConsoleKey.T, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),

                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),

                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false), // Tab a lot to make sure the rollover works

                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),
                new ConsoleKeyInfo('v', ConsoleKey.V, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('l', ConsoleKey.L, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeTrue();
            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.Single().Parameter.Name.ShouldBe("Param3");
            result.ValuedParameters.Single().Value.ShouldBe("val");
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 8
0
        public void WhenTabbingWithNoCommandEntered_AssertCommandInserted()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeTrue();
            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.ShouldBeEmpty();
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 9
0
        public void WhenHittingTabButNothingToTabTo_AssertTextUnchanged()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),

                new ConsoleKeyInfo('-', ConsoleKey.OemMinus, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),
                new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false),

                new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false),
                new ConsoleKeyInfo('v', ConsoleKey.V, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('l', ConsoleKey.L, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            var parser = new ConsoleCommandLineParser();
            ParseCommandLineResult result = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            result.ThinkWeHaveSomething.ShouldBeTrue();
            result.Command.Name.ShouldBe("Command1");
            result.FlaggedParameters.ShouldBeEmpty();
            result.ValuedParameters.Single().Parameter.Name.ShouldBe("a");
            result.ValuedParameters.Single().Value.ShouldBe("val");
            result.RemainingText.ShouldBeEmpty();
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            var commandCache             = new CommandCache();
            var consoleCommandLineParser = new ConsoleCommandLineParser();
            var console = new CommandingConsole();

            InitCommands(commandCache);

            while (true)
            {
                Console.WriteLine("Enter a command: ");
                ParseCommandLineResult result = consoleCommandLineParser.ParseCommandLine(commandCache, console);

                if (!result.ThinkWeHaveSomething)
                {
                    Console.WriteLine("No command parsed from string: " + result.ToString());
                }
                else
                {
                    Console.WriteLine($"Chosen Command: {result.Command.Name}");

                    Console.WriteLine("Flagged Params:");
                    foreach (ParameterOption flaggedParam in result.FlaggedParameters)
                    {
                        Console.WriteLine($"\t{flaggedParam.Name}");
                    }

                    Console.WriteLine("Valued Params:");
                    foreach ((ParameterOption parameter, string value) in result.ValuedParameters)
                    {
                        Console.WriteLine($"\t{parameter.Name}: {value}");
                    }

                    Console.WriteLine($"Remaining Text: {result.RemainingText}");
                }
            }
        }
Ejemplo n.º 11
0
        public void WhenUsingDownArrowForPastResultsIsPressedALot_AssertDirectResult()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            //Type in Command1 10 times, meaning the entire history is filled with this one
            var parser = new ConsoleCommandLineParser();

            for (int i = 0; i < 10; i++)
            {
                parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);
                _commandingConsoleSubstitute.ResetNextKeyIndex();
            }

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('2', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            //Type in Command2 one time, so only the first command in history buffer is Command2 and the rest are Command1
            for (int i = 0; i < 1; i++)
            {
                parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);
                _commandingConsoleSubstitute.ResetNextKeyIndex();
            }

            //Hit up arrow key 9 times. Meaning skip over the most recent Command2 and get Command1
            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                //Add a few misc characters to prove they're removed when using up arrow
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),

                //Down arrow 10 times so it goes past the history buffer
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),

                //Down arrow 10 more times to go to the only instance of Command2 in the history buffer. The one at the front. Index 0
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            ParseCommandLineResult finalResult = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            finalResult.ThinkWeHaveSomething.ShouldBeTrue();
            finalResult.Command.Name.ShouldBe("Command2");
        }
Ejemplo n.º 12
0
        public void WhenUsingPastResultsDownArrow_AssertDirectResult()
        {
            ICommandCache commandCache = GenerateCommandCache();

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('1', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            //Type in Command1 10 times, meaning the entire history is filled with this one
            var parser = new ConsoleCommandLineParser();

            for (int i = 0; i < 10; i++)
            {
                parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);
                _commandingConsoleSubstitute.ResetNextKeyIndex();
            }

            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                new ConsoleKeyInfo('C', ConsoleKey.C, true, false, false),
                new ConsoleKeyInfo('o', ConsoleKey.O, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('n', ConsoleKey.N, false, false, false),
                new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false),
                new ConsoleKeyInfo('2', ConsoleKey.NumPad1, false, false, false),
                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            //Type in Command2 3 times, so only the very last item is Command1
            for (int i = 0; i < 3; i++)
            {
                parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);
                _commandingConsoleSubstitute.ResetNextKeyIndex();
            }

            //Hit up down key 8 times. Meaning start looking at the end of the history buffer and end of on the last instance of Command2 typed in
            _commandingConsoleSubstitute.SetConsoleKeyInfoOrder(new[]
            {
                //Add a few misc characters to prove they're removed when using up arrow
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),
                new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false),

                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),
                new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, true, false, false),

                new ConsoleKeyInfo('\n', ConsoleKey.Enter, false, false, false),
            });

            ParseCommandLineResult finalResult = parser.ParseCommandLine(commandCache, _commandingConsoleSubstitute);

            finalResult.ThinkWeHaveSomething.ShouldBeTrue();
            finalResult.Command.Name.ShouldBe("Command2");
        }