/// <summary> /// Execute command if its one of the { 'L', 'R', 'M' } /// Rover will not move further if it hit the boundary /// </summary> /// <param name="rover"></param> /// <param name="command"></param> private void ExecuteCommand(IRover rover, char command) { switch (command) { case 'L': rover.RotateLeft(); break; case 'R': rover.RotateRight(); break; case 'M': if (!_plateau.OutOfBound(rover.GetDest().X, rover.GetDest().Y)) { rover.Move(); } break; default: throw new InvalidInputException(command + " is not valid input for command!"); } }