public void GetDefaultBoardSquareExpectNull() { int x = 0; int y = 0; _board = new GameBoard(_squares); var value = _board.GetSquare(x, y); Assert.IsNull(value); }
public void SetAndGetBoardSquare2by0() { int x = 2; int y = 0; NoughtCrossToken value = NoughtCrossToken.X; _board = new GameBoard(_squares); _board.SetSquare(x, y, value); var setValue = _board.GetSquare(x, y); Assert.AreEqual(value, setValue); }
public void DisplayBoardScreen(IGameBoard gameBoard) { Console.WriteLine("/*/*/*/*/*/*"); _gameBoard = gameBoard; var squares = _gameBoard.GetBoard(); Console.WriteLine(); Console.Write("y "); for (var i = 0; i < squares[0].Length; i++) { Console.Write("= "); } Console.WriteLine(" "); for (var i = 0; i < squares.Length; i++) { var k = (2 - i); Console.Write(k.ToString() + "|"); for (var j = 0; j < squares[i].Length; j++) { var l = (2 - j); var token = _gameBoard.GetSquare(j, k); if (token == null) { Console.Write(" "); } else if (token == NoughtCrossToken.X) { Console.Write("X"); } else if (token == NoughtCrossToken.O) { Console.Write("O"); } if (j != (squares[i].Length - 1)) { Console.Write("|"); } } Console.WriteLine("|"); if (i != (squares.Length - 1)) { Console.WriteLine(" = = = "); } } Console.Write(" "); for (var i = 0; i < squares[0].Length; i++) { Console.Write("= "); } Console.Write(" "); Console.WriteLine(); Console.Write("x "); for (var i = 0; i < squares[0].Length; i++) { Console.Write(i.ToString() + " "); } Console.WriteLine(); Console.WriteLine("/*/*/*/*/*/*"); Console.WriteLine(); }