Exemplo n.º 1
0
 public void ValidateParametersCount(Command command, int count)
 {
     if (command.Parameters.Length != count)
     {
         throw new InvalidOperationException(Constants.InvalidCommand);
     }
 }
Exemplo n.º 2
0
        public void Run()
        {
            while (true)
            {
                string input = this.userInterface.ReadLine();
                string output;

                if (string.IsNullOrWhiteSpace(input))
                {
                    break;
                }

                input = input.Trim();
                try
                {
                    this.Command = new Command(input);
                    output = this.controller.ExecuteCommand();
                }
                catch (Exception ex)
                {
                    output = ex.Message;
                }

                this.userInterface.WriteLine(output);
            }
        }