public void TestingCurrentArrayValue_SendingInLegalValue()
        {
            //Arrange
            Board br = new Board();
            var expected = 2;

            //Act
            br.NewMove(2, 2, 2); //Legal array coord 1,1 with legal with legal value
            var Array = br.GetArray();
            var actual = Array[1, 1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TestingEmptyArray_Mid()
        {
            //Arrange
            Board br = new Board();
            var expected = 0;

            //Act
            br.InitializeBoard();
            var Empty_Arrey = br.GetArray();
            var actual = Empty_Arrey[1, 1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        /// <summary>
        ///  Draws the status of the gameBoard to a console window
        /// </summary>
        /// <param name="gameVoard">an instance of the gameBoard</param>
        public void Draw(Board gameBoard)
        {
            ClearScreen();
            DrawHeader();
            int gameBoardSize = gameBoard.GetBoardSize();
            int[,] gameBoardArray = new int[gameBoardSize, gameBoardSize];

            gameBoardArray = gameBoard.GetArray();
            for (int y = 1; y <= gameBoardSize; y++)

            {
                for (int x = 1; x <= gameBoardSize; x++)
                {
                    if (x == 1)
                        Console.Write(" " + ValueToSymbol(gameBoardArray[x-1, y-1]) + " |");
                    else if (x == gameBoardSize)
                        Console.Write("| " + ValueToSymbol(gameBoardArray[x-1, y-1]) + " ");
                    else
                        Console.Write(" " + ValueToSymbol(gameBoardArray[x-1, y-1]) + " ");
                }
                if (y == selectedRow)
                {
                    Console.Write("<");
                }
                Console.WriteLine();
                if (y != gameBoardSize)
                    Console.WriteLine("-----------");
            }
            Console.WriteLine();
            for (int x=1; x <= gameBoardSize; x++)
            {
                if (x == selectedColumn)
                    Console.WriteLine(" ^ ");
                else
                    Console.Write("    ");
            }
            Console.WriteLine();
        }