public void OwnerPropertySet_WhenSetToPlayer() { BattleShield shield = new IronBattleShield(1, 0, 0); Assert.AreEqual(null, shield.Owner); _humanPlayer1.SetBattleShield(shield); Assert.AreEqual(null, shield.Owner); Assert.AreEqual(_humanPlayer1, _humanPlayer1.BattleShield.Owner); }
public void SetBattleShieldMethod_AppropriatelyRaisesBattleShieldAddedEvent() { IBattleShield shield = new IronBattleShield(1, 0, 0); _fighter.SetBattleShield((BattleShield)shield); List <EventLog> logs = _logger.Logs; Assert.AreEqual(1, logs.Count); EventLog log = logs[0]; Assert.AreEqual(EventType.ShieldAdded, log.Type); ShieldAddedEventArgs e = log.E as ShieldAddedEventArgs; Assert.NotNull(e); Assert.IsTrue(shield.AreEqual(e.BattleShield)); }
public void BattleManager_CorrectlyExecutes_ShieldFortifyingMove([Values(ShieldFortifyingType.Defense, ShieldFortifyingType.Health)] ShieldFortifyingType shieldFortifyingType) { ElementalBattleShield shield = new ElementalBattleShield(10, 5, 0, MagicType.Fire); shield.DecrementHealth(5); _humanFighter.SetBattleShield(shield); IBattleShield copiedShield = _humanFighter.BattleShield; ShieldFortifyingMove shieldFortifyingMove = new ShieldFortifyingMove("foo", TargetType.Self, null, shieldFortifyingType, 5); _humanFighter.SetMove(shieldFortifyingMove, 1); _humanFighter.SetMove(_runawayMove); _humanFighter.SetMoveTarget(_humanFighter); _enemy.SetMove(_doNothing); _battleManager.Battle(_humanTeam, _enemyTeam); Assert.NotNull(copiedShield); int actualValue = shieldFortifyingType == ShieldFortifyingType.Defense ? copiedShield.Defense : copiedShield.CurrentHealth; Assert.AreEqual(10, actualValue); }