public void TestFlagVisitorIsChangingState()
 {
     Cell cell = new MineCell(new Position(1, 1));
     IVisitor visitor = new FlagVisitor();
     visitor.Visit(cell);
     Assert.AreEqual(cell.Type, CellTypes.Flag);
 }
 public void TestCellRevealingVisitorIsChangingState()
 {
     Cell cell = new MineCell(new Position(1, 1));
     IVisitor visitor = new CellRevealingVisitor();
     cell.Accept(visitor);
     Assert.AreEqual(true, cell.IsCellRevealed);
 }
 public void TestFlagVisitorIsKeepingStateWhenCellIsRevealled()
 {
     Cell cell = new MineCell(new Position(1, 1));
     IVisitor visitor = new FlagVisitor();
     cell.IsCellRevealed = true;
     cell.Accept(visitor);
     Assert.AreNotEqual(cell.Type, CellTypes.Safe);
 }
Example #4
0
 public void TestMineCellVisitor()
 {
     var visitorMock = new Mock<IVisitor>();
     visitorMock.Setup(v => v.Visit(It.IsAny<Cell>())).Verifiable();
     MineCell cell = new MineCell(new Position(1, 1));
     cell.Accept(visitorMock.Object);
     visitorMock.Verify();
 }
Example #5
0
 public void TestMineCellType()
 {
     Cell cell = new MineCell(new Position(1, 1));
     Assert.AreEqual(CellTypes.Mine, cell.Type);
 }
Example #6
0
 public void TestCellRevealMethod()
 {
     Cell cell = new MineCell(new Position(1, 1));
     cell.RevealCell();
     Assert.AreEqual(true, cell.IsCellRevealed);
 }
Example #7
0
 public void TestCellPositionCoordinates()
 {
     Cell cell = new MineCell(new Position(5, 5));
     Assert.AreEqual(new Position(5, 5), cell.Coordinates);
 }
Example #8
0
 public void TestCellConstructorWithNegativeRowValue()
 {
     Cell cell = new MineCell(new Position(-1, 5));
 }
Example #9
0
 public void TestCellConstructorWithNegativeColValue()
 {
     Cell cell = new MineCell(new Position(1, -5));
 }