public void WarpDriveDecorateShipTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); var oSpeed = ship.Speed; var oHealth = ship.Health; var oPower = ship.Power; var oArmor = ship.Armor; var newImplement = UpgradeImplementFactory.CreateUpgradeImplement(UpgradeImplementType.WarpDrive); UpgradeImplementDecorator.DecorateShip(ship, newImplement); Assert.True(ship.Speed == (oSpeed + newImplement.ShipSpeedModification) || ship.Speed == 0); Assert.True(ship.Health == (oHealth + newImplement.ShipHealthModification) || ship.Health == 0); Assert.True(ship.Power == (oPower + newImplement.ShipPowerModification) || ship.Power == 0); Assert.True(ship.Armor == (oArmor + newImplement.ShipArmorModification) || ship.Armor == 0); Assert.Equal(1, ship.UpgradeImplements.Count()); }
public void PlasmaCannonDecorateShipTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); var oSpeed = ship.Speed; var oHealth = ship.Health; var oPower = ship.Power; var oArmor = ship.Armor; var newImplement = AttackImplementFactory.CreateAttackImplement(AttackImplementType.PlasmaCannon); AttackImplementDecorator.DecorateShip(ship, newImplement); Assert.True(ship.Speed == (oSpeed + newImplement.ShipSpeedModification) || ship.Speed == 0); Assert.True(ship.Health == (oHealth + newImplement.ShipHealthModification) || ship.Health == 0); Assert.True(ship.Power == (oPower + newImplement.ShipPowerModification) || ship.Power == 0); Assert.True(ship.Armor == (oArmor + newImplement.ShipArmorModification) || ship.Armor == 0); Assert.Equal(1, ship.AttackImplements.Count()); }
public void MineFieldDecorateToLargeShipTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); var oSpeed = ship.Speed; var oHealth = ship.Health; var oPower = ship.Power; var oArmor = ship.Armor; var newImplement = UpgradeImplementFactory.CreateUpgradeImplement(UpgradeImplementType.MineField); UpgradeImplementDecorator.DecorateShip(ship, newImplement); Assert.True(ship.Speed == oSpeed); Assert.True(ship.Health == oHealth); Assert.True(ship.Power == oPower); Assert.True(ship.Armor == oArmor); Assert.Equal(0, ship.UpgradeImplements.Count()); }
public void ShieldBoosterDecorateShipTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); var oSpeed = ship.Speed; var oHealth = ship.Health; var oPower = ship.Power; var oArmor = ship.Armor; var newImplement = DefendImplementFactory.CreateDefendImplement(DefendImplementType.ShieldBooster); DefendImplementDecorator.DecorateShip(ship, newImplement); Assert.True(ship.Speed == (oSpeed + newImplement.ShipSpeedModification) || ship.Speed == 0); Assert.True(ship.Health == (oHealth + newImplement.ShipHealthModification) || ship.Health == 0); Assert.True(ship.Power == (oPower + newImplement.ShipPowerModification) || ship.Power == 0); Assert.True(ship.Armor == (oArmor + newImplement.ShipArmorModification) || ship.Armor == 0); Assert.Equal(1, ship.DefendImplements.Count()); }
private static void SetDecorations(IStarShip ship, ShipType?shipType, ShipConfigurationType?configurationType) { if (shipType != null && configurationType != null) { IShipConfiguration conCollection = ShipConfigurationFactory.CreateShipConfiguration(shipType, configurationType); foreach (var i in conCollection.upgradeImplements) { UpgradeImplementDecorator.DecorateShip(ship, i); } foreach (var i in conCollection.defendImplements) { DefendImplementDecorator.DecorateShip(ship, i); } foreach (var i in conCollection.attackImplements) { AttackImplementDecorator.DecorateShip(ship, i); } } }
public void Fire(IFleet enemyFleet, BattleStratageyType battleStratageyType) { if (AmmoAvailable) { if (Ammo.HasValue) { Ammo = Ammo - 1; } IStarShip ship = GetTargetShip(battleStratageyType, enemyFleet); if (ship != null) { AttackResult result = new AttackResult { Damage = CalculateDamage() }; AttackAggregator battleAttackAggregator = new AttackAggregator(); battleAttackAggregator.RegisterObserver(ship); battleAttackAggregator.NotifyObservers(result); battleAttackAggregator.UnregisterObserver(ship); } } }
public StarShipServiceTest() { IStarShip starShipMock = CriarMockStarShip(); this.starShipService = new StarShipService(starShipMock); }
public void FighterNumberOfUpgradeSlotsBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(5, ship.NumberOfUpgradeSlots); }
public void FighterSizeBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(70, ship.Size); }
public void FighterPowerBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(100, ship.Power); }
public void DestroyerNumberOfUpgradeSlotsAvailableBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Destroyer, null); Assert.Equal(20, ship.NumberOfUpgradeSlotsAvailable); }
public void DestroyerNumberOfDefendSlotsBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Destroyer, null); Assert.Equal(50, ship.NumberOfDefendSlots); }
public void DestroyerHealthBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Destroyer, null); Assert.Equal(1000, ship.Health); }
public void DestroyerSizeBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Destroyer, null); Assert.Equal(2000, ship.Size); }
public void DestroyerArmorBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Destroyer, null); Assert.Equal(270, ship.Armor); }
public void FleetTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, ShipConfigurationType.Light); Assert.True(ship.availableAttackImplements.Count > 0); }
public StarShipService(IStarShip starShipFacade) { this.starShipFacade = starShipFacade; this.DayConverter = new DayConverter(); this.calculationStops = new CalculationStops(); }
public void FrigetArmorBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Friget, null); Assert.Equal(180, ship.Armor); }
public void FighterArmorBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(90, ship.Armor); }
public void FrigetHealthBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Friget, null); Assert.Equal(500, ship.Health); }
public void FighterHealthBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(250, ship.Health); }
public void FrigetNumberOfDefendSlotsBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Friget, null); Assert.Equal(20, ship.NumberOfDefendSlots); }
public void FighterNumberOfAttackSlotsAvailableBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Fighter, null); Assert.Equal(15, ship.NumberOfAttackSlotsAvailable); }
public void FrigetNumberOfUpgradeSlotsAvailableBaseValueTest() { IStarShip ship = ShipFactory.CreateShip(ShipType.Friget, null); Assert.Equal(10, ship.NumberOfUpgradeSlotsAvailable); }