public void ABattleShipCannotBeAddedTest(int shipStartPosX, int shipStartPosY, int shipEndPosX, int shipEndPosY) { _boardService = new BoardService(new Board(_boardWidth, _boardHeight)); _boardService.SetupBoard(); Ship ship = new Ship(new Position(shipStartPosX, shipStartPosY), new Position(shipEndPosX, shipEndPosY)); bool added = _boardService.AddShip(ship); Assert.AreEqual(added, false); }
public void MissTestForOneShipInTheBoard(int posX1, int posY1, int posX2, int posY2, int attackX, int attackY) { _boardService = new BoardService(new Board(_boardWidth, _boardHeight)); _boardService.SetupBoard(); Position start = new Position(posX1, posY1); Position end = new Position(posX2, posY2); Ship ship = new Ship(start, end); _boardService.AddShip(ship); bool isHit = _boardService.Attack(new Position(attackX, attackY)); Assert.AreEqual(isHit, false); }
public void SinkTestForOneShipOnTheBoard(int shipStartPosX, int shipStartPosY, int shipEndPosX, int shipEndPosY) { _boardService = new BoardService(new Board(_boardWidth, _boardHeight)); _boardService.SetupBoard(); Ship ship = new Ship(new Position(shipStartPosX, shipStartPosY), new Position(shipEndPosX, shipEndPosY)); _boardService.AddShip(ship); foreach (Position position in _attackPositions) { _boardService.Attack(position); } Assert.AreEqual(_boardService.AllShipsSunk, true); }