示例#1
0
        public void NineXNineBoardGeneration()
        {
            var board = TicTacToeGame.GenerateBoard(new Dimension(9));

            Assert.AreEqual(9, board.Cells.Count, "Incorrect board dimension");
            Assert.IsTrue((from row in board.Cells
                           select row.Count == 9)
                          .ForAll(isCorrect => isCorrect), "Incorrect row dimension");
            var allCellEmpty = from row in board.Cells
                               from cel in row
                               select cel.IsNone;

            Assert.IsTrue(allCellEmpty.ForAll(isNone => isNone), "Board is not empty");
            Assert.AreEqual(GameStatus.InProgress, board.Status, "For empty board game should be in progress");
            Assert.IsTrue(board.Winner.IsNone, "For empty board there should be no winner");
        }
示例#2
0
        public void EmptyBoardXMovesNext()
        {
            var board = TicTacToeGame.GenerateBoard(new Dimension(3));

            Assert.AreEqual(Shapes.X, board.NextMoveShape, "X should move next");
        }
示例#3
0
 public void InvalidBoardDimension()
 {
     var board = TicTacToeGame.GenerateBoard(new Dimension(11));
 }