public void TestDrawPlayingFiel_WithTenRowsAndTenCols()
        {
            GameField gameField = new GameField(10, 10);
            char[,] board = gameField.Create();

            StringBuilder expectedOutput = new StringBuilder();

            expectedOutput.AppendFormat("    0 1 2 3 4 5 6 7 8 9{0}", Environment.NewLine);
            expectedOutput.AppendFormat("   ---------------------{0}", Environment.NewLine);
            expectedOutput.AppendFormat("0 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("1 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("2 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("3 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("4 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("5 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("6 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("7 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("8 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("9 | ? ? ? ? ? ? ? ? ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("   ---------------------{0}", Environment.NewLine);

            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);
                Draw.PlayingField(board);
                Assert.AreEqual<string>(expectedOutput.ToString(), sw.ToString());
            }
        }
        public void TestExecuteCommand_WithRestartCommand()
        {
            Engine game = new Engine();
            GameField gameField = new GameField(2, 2);

            char[,] fieldWithQuestionMarks = gameField.Create();
            char[,] fieldWithBombs = gameField.PlaceBombs();

            int maxScore = (gameField.FieldCols * gameField.FieldCols) -
                           (gameField.FieldCols + gameField.FieldCols);

            string inputCommand = "restart";

            StringBuilder expectedOutput = new StringBuilder();
            expectedOutput.AppendFormat("    0 1 2 3 4 5 6 7 8 9{0}", Environment.NewLine);
            expectedOutput.AppendFormat("   ---------------------{0}", Environment.NewLine);
            expectedOutput.AppendFormat("0 | ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("1 | ? ? |{0}", Environment.NewLine);
            expectedOutput.AppendFormat("   ---------------------{0}", Environment.NewLine);

            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);
                game.ExecuteCommand(inputCommand, gameField, fieldWithQuestionMarks, fieldWithBombs, maxScore);
                Assert.AreEqual<string>(expectedOutput.ToString(), sw.ToString());
            }
        }
        public void TestExecuteCommand_WithTopCommand()
        {
            Engine game = new Engine();
            GameField gameField = new GameField(10, 10);

            char[,] fieldWithQuestionMarks = gameField.Create();
            char[,] fieldWithBombs = gameField.PlaceBombs();

            int maxScore = (gameField.FieldCols * gameField.FieldCols) -
                           (gameField.FieldCols + gameField.FieldCols);

            string inputCommand = "top";

            List<Player> topPlayers = new List<Player>();

            StringBuilder expectedOutput = new StringBuilder();
            expectedOutput.AppendLine("Points:");
            expectedOutput.AppendLine("Empty score board.");

            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);
                game.ExecuteCommand(inputCommand, gameField, fieldWithQuestionMarks, fieldWithBombs, maxScore);
                Assert.AreEqual<string>(expectedOutput.ToString(), sw.ToString());
            }
        }
        public void TestCreate_FiveRowsFiveCols()
        {
            GameField gameField = new GameField(5, 5);

            char[,] expected = {
                                   {'?', '?', '?', '?', '?'},
                                   {'?', '?', '?', '?', '?'},
                                   {'?', '?', '?', '?', '?'},
                                   {'?', '?', '?', '?', '?'},
                                   {'?', '?', '?', '?', '?'},
                               };

            for (int i = 0; i < gameField.FieldRows; i++)
            {
                for (int j = 0; j < gameField.FieldCols; j++)
                {
                    Assert.AreEqual(expected[i,j], gameField.Create()[i,j]);
                }
            }
        }
        public void TestParseInputCommand_WithRowsAndColsCommand()
        {
            Engine game = new Engine();
            GameField gameField = new GameField(10, 10);

            char[,] fieldWithQuestionMarks = gameField.Create();

            string actual = game.ParseInputCommand("5x5", fieldWithQuestionMarks);
            string expected = "turn";

            Assert.AreEqual(expected, actual);
        }