Exemplo n.º 1
0
        public void TestCheckCells_TryAddShipToX2Y3DirRightIfShipX9Y2DirLeftNearby_ReturnFalse()
        {
            BattleshipBoard board = new BattleshipBoard(10);
            int             x     = 9;
            int             y     = 2;
            Directions      dir   = Directions.LEFT;

            int        testShipX     = 2;
            int        testShipY     = 3;
            Directions testShipDir   = Directions.RIGHT;
            Ship       ship          = new Ship(x, y, ShipTypes.BATTLESHIP, dir);
            int        testDeckCount = board.GetDeckCount(ShipTypes.BATTLESHIP);

            board.AddShip(ship);
            Ship testShip = new Ship(testShipX, testShipY, ShipTypes.BATTLESHIP, testShipDir);
            bool success  = board.CheckCells(testShipX, testShipY, board, testDeckCount, testShipDir);

            if (success)
            {
                board.AddShip(testShip);
            }
            Assert.IsFalse(board.ShipsList.Contains(testShip));
        }