Exemplo n.º 1
0
        public void ShouldExecuteCommandsMatchingArgs()
        {
            var program = "test.exe";
            var commands = new string[0];
            var args = new[] { "two", "worker" };
            var workerCommand = new TestWorkerCommand();
            new RouteCommand(new Dictionary<string, Command>
                               {
                                   {"one", new DummyCommand()},
                                   {
                                       "two", new RouteCommand(new Dictionary<string, Command>
                                                                 {
                                                                     {"a", new DummyCommand()},
                                                                     {"b", new DummyCommand()},
                                                                     {"worker", workerCommand},
                                                                 })
                                   },
                                   {"three", new DummyCommand()}
                               }).Execute(program, commands, args, new CmdLineSettings());

            workerCommand.Executed.ShouldBe(true);
        }
 private static void ShouldOutputHelp(string program, string[] commands, OptionValueFormat optionValueFormat, string expected)
 {
     var command = new TestWorkerCommand { TestWriter = new TestWriter() };
     command.Execute(program, commands, new[] { "?" }, new CmdLineSettings { OptionValueFormat = optionValueFormat });
     command.TestWriter.ToString().ShouldBe(expected);
 }