public void Constructor_TestIfInitializesEmptyCells() { int gridRows = 10, gridCols = 10, minesCount = 4; MinesweeperGrid grid = new MinesweeperGrid(gridRows, gridCols, minesCount); bool existsNonEmptyCell = false; for (int i = 0; i < gridRows; i++) { for (int j = 0; j < gridCols; j++) { if (grid.GetCellValue(i, j) != MinesweeperCell.EmptyCell) { existsNonEmptyCell = true; break; } } if (existsNonEmptyCell) { break; } } Assert.IsFalse(existsNonEmptyCell); }
public void GetCellValue_TestWithValidCellPosition() { int gridRows = 10, gridCols = 10, minesCount = 4; MinesweeperGrid grid = new MinesweeperGrid(gridRows, gridCols, minesCount); grid.SetCellValue(1, 1, '+'); Assert.AreEqual('+', grid.GetCellValue(1, 1)); }
public void MarkCell_WhenThereAreUnrevealedCells() { 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.MarkCell('+'); Assert.AreEqual('+', grid.GetCellValue(1, 2)); }