Exemple #1
0
        public void MagicalDamageMethod_AppropriatelyAltersCurrentHealth([Values(1, 3)] int remainingHealth)
        {
            int damage = FighterHealth - remainingHealth;
            var ret    = _fighter.MagicalDamage(damage, MagicType.Lightning);

            Assert.AreEqual(remainingHealth, _fighter.CurrentHealth);
            Assert.AreEqual(FighterHealth, _fighter.MaxHealth);

            Assert.AreEqual(damage, ret);
        }
Exemple #2
0
        public void MagicalDamageMethod_AppropriatelyRaisesEvents_WhenFighterSurvives()
        {
            _fighter.SetHealth(4);
            _fighter.MagicalDamage(3, MagicType.Water);

            var logs = _logger.Logs;

            Assert.AreEqual(1, logs.Count);
            Assert.AreEqual(EventType.MagicalDamageTaken, logs[0].Type);
            Assert.AreEqual(_fighter, logs[0].Sender);
            var e = logs[0].E as MagicalDamageTakenEventArgs;

            Assert.NotNull(e);
            Assert.AreEqual(3, e.Damage);
            Assert.AreEqual(MagicType.Water, e.MagicType);
        }
        public void RemovedFromPlayer_WhenDestroyed_MagicalDamage()
        {
            _humanPlayer1.SetBattleShield(_shield as BattleShield);
            IBattleShield shield = _humanPlayer1.BattleShield;

            _logger.SubscribeAll(shield);

            Assert.That(_humanPlayer1.BattleShield, Is.Not.Null);

            _humanPlayer1.MagicalDamage(_shield.MaxHealth, MagicType.Fire);

            Assert.That(_humanPlayer1.BattleShield, Is.Null);
            Assert.AreEqual(_humanPlayer1.MaxHealth, _humanPlayer1.CurrentHealth);
        }