public void ChartPlacementAfter5()
        {
            BalloonsEngine game = new BalloonsEngine(5, 10);
            game.UserMoves = 5;
            for (int i = 0; i < 5; i++)
            {
                game.UserMoves++;
                game.RecordHighscore(i.ToString(), game.ChartPlaceIndex());
            }

            game.UserMoves = 1;
            game.RecordHighscore("FirstPlace", game.ChartPlaceIndex());

            StringBuilder expectedBuilder = new StringBuilder();
            expectedBuilder.AppendLine("---------TOP FIVE CHART-----------");
            expectedBuilder.AppendFormat("{2}. {0} with {1} moves.\n", "FirstPlace", 1, 1);
            for (int i = 2; i <= 5; i++)
            {
                expectedBuilder.AppendFormat("{2}. {0} with {1} moves.\n", (i - 2).ToString(), i + 4, i);
            }

            expectedBuilder.AppendLine("----------------------------------");

            Assert.AreEqual(expectedBuilder.ToString(), game.GenerateChart());
        }
        /// <summary>
        /// Executes a command from a predefined set of commands or breaks if invalid command.
        /// </summary>
        /// <param name="game">Instace of the BalloonsEngine class.</param>
        /// <param name="command">User input command to execute.</param>
        private static void ExecuteCommand(BalloonsEngine game, string command)
        {
            switch (command)
            {
                case "restart":
                    Console.WriteLine();
                    PrintIntroMessage();
                    game.RestartGame();
                    Console.WriteLine(game.FieldOutput());
                    break;

                case "top":
                    Console.WriteLine(game.GenerateChart());
                    break;

                case "exit":
                    PrintExitMessage();
                    break;

                default:
                    if (game.CheckMoveValidity(command))
                    {
                        ProcessMove(command, game);
                    }
                    else
                    {
                        PrintInvalidCommandMessage();
                    }

                    break;
            }
        }
        /// <summary>
        /// Executes a command from a predefined set of commands or breaks if invalid command.
        /// </summary>
        /// <param name="game">Instace of the BalloonsEngine class.</param>
        /// <param name="command">User input command to execute.</param>
        private static void ExecuteCommand(BalloonsEngine game, string command)
        {
            switch (command)
            {
            case "restart":
                Console.WriteLine();
                PrintIntroMessage();
                game.RestartGame();
                Console.WriteLine(game.FieldOutput());
                break;

            case "top":
                Console.WriteLine(game.GenerateChart());
                break;

            case "exit":
                PrintExitMessage();
                break;

            default:
                if (game.CheckMoveValidity(command))
                {
                    ProcessMove(command, game);
                }
                else
                {
                    PrintInvalidCommandMessage();
                }

                break;
            }
        }
        public void GenerateChartOutputWithoutTop()
        {
            BalloonsEngine game = new BalloonsEngine(5, 10);
            game.TryPopBalloons(2, 6);
            string result = game.GenerateChart();

            StringBuilder expectedResult = new StringBuilder();
            expectedResult.AppendLine("The scoreboard is empty.");

            Assert.AreEqual(expectedResult.ToString(), result);
        }
        /// <summary>
        /// Processes the move entered by the player.
        /// </summary>
        /// <param name="userInput">Row and column of the move.</param>
        /// <param name="game">Instace of the BalloonsEngine class.</param>
        private static void ProcessMove(string userInput, BalloonsEngine game)
        {
            int userRow, userColumn;

            userRow    = ConvertCharToInt(userInput[0]);
            userColumn = ConvertCharToInt(userInput[2]);

            if (!game.TryPopBalloons(userRow, userColumn))
            {
                PrintIllegalMoveMessage();
            }

            game.UserMoves++;
            game.CollapseRows();

            if (game.CheckIfWinning())
            {
                Console.WriteLine(game.FieldOutput());
                Console.WriteLine("Congratulations! You popped all baloons in {0} moves.", game.UserMoves);

                int place = game.ChartPlaceIndex();
                if (place != -1)
                {
                    Console.WriteLine("Please enter your name for the top scoreboard: ");
                    string username = Console.ReadLine();
                    game.RecordHighscore(username, place);
                    Console.WriteLine(game.GenerateChart());
                }
                else
                {
                    Console.WriteLine("Game Over!");
                    Console.WriteLine(game.GenerateChart());
                }

                game.RestartGame();
            }

            Console.WriteLine(game.FieldOutput());
        }
        /// <summary>
        /// Processes the move entered by the player.
        /// </summary>
        /// <param name="userInput">Row and column of the move.</param>
        /// <param name="game">Instace of the BalloonsEngine class.</param>
        private static void ProcessMove(string userInput, BalloonsEngine game)
        {
            int userRow, userColumn;
            userRow = ConvertCharToInt(userInput[0]);
            userColumn = ConvertCharToInt(userInput[2]);

            if (!game.TryPopBalloons(userRow, userColumn))
            {
                PrintIllegalMoveMessage();
            }

            game.UserMoves++;
            game.CollapseRows();

            if (game.CheckIfWinning())
            {
                Console.WriteLine(game.FieldOutput());
                Console.WriteLine("Congratulations! You popped all baloons in {0} moves.", game.UserMoves);

                int place = game.ChartPlaceIndex();
                if (place != -1)
                {
                    Console.WriteLine("Please enter your name for the top scoreboard: ");
                    string username = Console.ReadLine();
                    game.RecordHighscore(username, place);
                    Console.WriteLine(game.GenerateChart());
                }
                else
                {
                    Console.WriteLine("Game Over!");
                    Console.WriteLine(game.GenerateChart());
                }

                game.RestartGame();
            }

            Console.WriteLine(game.FieldOutput());
        }
        public void GenerateChartOutputWithTop()
        {
            BalloonsEngine game = new BalloonsEngine(5, 10);

            TestUtils.PopAllBalloons(game);
            int place = game.ChartPlaceIndex();
            string result = string.Empty;
            if (place != -1)
            {
                game.RecordHighscore("Bunny", place);
                result = game.GenerateChart();
            }

            StringBuilder expectedResult = new StringBuilder();
            expectedResult.AppendLine("---------TOP FIVE CHART-----------");
            expectedResult.AppendFormat("{2}. {0} with {1} moves.\n", "Bunny", game.UserMoves, 1);
            expectedResult.AppendLine("----------------------------------");

            Assert.AreEqual(expectedResult.ToString(), result);
        }