Exemplo n.º 1
0
        public void PlaceShip(ShipLocation shipLocation)
        {
            _playerValidator.ValidateNumberOfPlacedShips(shipLocation.Ship, _ships);

            _ships.Add(shipLocation.Ship);
            OwnBoard.SetShip(shipLocation);
        }
Exemplo n.º 2
0
        public void CannotAddMoreShipsThanInSettings()
        {
            var ships = new List <IShip>()
            {
                ShipsFactory.CreateBattleShip(),
                ShipsFactory.CreateBattleShip(),
                ShipsFactory.CreateBattleShip()
            };

            Assert.Throws <InvalidOperationException>(
                () => _playerValidator.ValidateNumberOfPlacedShips(ShipsFactory.CreateBattleShip(), ships),
                "It shouldn't be possible to add more ships than in settings");
        }