public void TestIfCheckForMineReturnsTrueWhenThereIsMine() { var moq = new Mock<IGameBoard>(); moq.SetupGet(b => b.Board).Returns(cellMatrix); Position pos = new Position(0, 0); moq.Setup(x => x.CheckIfHasMine(pos)).Returns(cellMatrix[pos.Row, pos.Col] is MineCell); Assert.IsTrue(moq.Object.CheckIfHasMine(pos)); }
/// <summary> /// Initializes a new instance of the MineCell class. /// </summary> /// <param name="row">Takes one integer parameter for the row of the cell.</param> /// <param name="col">Takes one integer parameter for the col of the cell.</param> public MineCell(Position pos) : base(pos) { this.Type = CellTypes.Mine; }
/// <summary> /// Initializes a new instance of the SafeCell class. /// </summary> /// <param name="row">Takes one integer parameter for the row of the cell.</param> /// <param name="col">Takes one integer parameter for the col of the cell.</param> public SafeCell(Position pos) : base(pos) { this.NumberOfNeighbouringMines = INITIAL_MINES_COUNT; this.Type = CellTypes.Safe; }
public void TestIfInsideBoardReturnsTrueWhenCellIsInsideTheBoard() { Position pos = new Position(3, 5); Assert.IsTrue(board.IsInsideBoard(pos)); }
public void TestIfInsideBoardReturnFalseWhenCellRowIsNegativeNumber() { Position pos = new Position(-1, 5); Assert.IsFalse(board.IsInsideBoard(pos)); }
public void TestIfInsideBoardReturnFalseWhenCellRowIsBiggerThanMaxCols() { Position pos = new Position(50, 5); Assert.IsFalse(board.IsInsideBoard(pos)); }
/// <summary> /// The constructor can be used by the inheriting classes. /// </summary> /// <param name="row">Takes one integer parameter for the row of the cell.</param> /// <param name="col">Takes one integer parameter for the col of the cell.</param> protected Cell(Position pos) { this.isCellRevealed = false; this.Coordinates = new Position(pos.Row, pos.Col); }