Esempio n. 1
0
        public void MinesweeperBoard_CascadesWholeBoard_WithNoMines()
        {
            int width = 50, height = 50;
            var board = new MinesweeperBoard(width, height, 0);
            board.Uncover(0, 0, 0);

            for (var i = 0; i < width; i++)
            {
                for (var j = 0; j < height; j++)
                {
                    if (board[i, j].Status == CellStatus.Covered)
                    {
                        Assert.Fail("Board with no mines has invalid cell status");
                    }
                }
            }
        }
Esempio n. 2
0
 public void MinesweeperBoard_CascadesAllButOne_WithOneMine()
 {
     int width = 50, height = 50;
     var board = new MinesweeperBoard(width, height, 0);
     board[0, 0].Type = CellType.Mined;
     board.Uncover(25, 25, 0);
     var cascaded = 0;
     for (var i = 0; i < width; i++)
     {
         for (var j = 0; j < height; j++)
         {
             if (board[i, j].Status == CellStatus.Uncovered)
                 cascaded++;
         }
     }
     Assert.AreEqual(width * height - 1, cascaded, "Wrong number of cascaded cells");
 }