コード例 #1
0
        public void RevealMines_WhenTheGridContainsMines()
        {
            int             gridRows = 10, gridCols = 10, minesCount = 4;
            MinesweeperGrid grid = new MinesweeperGrid(gridRows, gridCols, minesCount);

            grid.SetCellValue(0, 0, '*');
            grid.SetCellValue(0, 1, '*');
            grid.SetCellValue(1, 0, '*');
            grid.SetCellValue(1, 2, '*');

            grid.RevealMines();
            Assert.AreEqual(4, grid.RevealedCount());
        }
コード例 #2
0
        public void RevealedCount_TestWhenSomeMinesAreRevealed()
        {
            int             gridRows = 10, gridCols = 10, minesCount = 4;
            MinesweeperGrid grid = new MinesweeperGrid(gridRows, gridCols, minesCount);

            grid.SetCellValue(0, 0, '*');
            grid.SetCellValue(0, 1, '*');
            grid.SetCellValue(1, 0, '*');
            grid.SetCellValue(1, 2, '*');

            grid.RevealCell(0, 0);
            grid.RevealCell(0, 1);

            Assert.AreEqual(2, grid.RevealedCount());
        }