コード例 #1
0
        public void DealDamage_WhenDefenderIsNull_ShouldThrowArgumentNullException()
        {
            ICreaturesInBattle defender = null;
            var tested = new CreaturesInBattle(new AncientBehemoth(), 1);

            Assert.Throws <ArgumentNullException>(() => tested.DealDamage(defender));
        }
コード例 #2
0
        public void DealDamage_WhenDefenderHasLargerDefence_ShouldReturnExpectedResult()
        {
            var defender = new CreaturesInBattle(new Behemoth(), 1);
            var attacker = new CreaturesInBattle(new AncientBehemoth(), 1);

            attacker.DealDamage(defender);

            var result = defender.TotalHitPoints;

            Assert.AreEqual(116, result);
        }
コード例 #3
0
        public void DealDamage_WhenDefenderIsValid_ShouldReturnExpectedResult()
        {
            var defender = new CreaturesInBattle(new Behemoth(), 2);
            var attacker = new CreaturesInBattle(new Behemoth(), 1);

            attacker.DealDamage(defender);

            var result = defender.TotalHitPoints;

            Assert.AreEqual(280, result);
        }
コード例 #4
0
        public void ReturnCorrectDefenderHitPoints_WhenDefenceIsNotHighterThanDamage()
        {
            var attackerInBattle = new CreaturesInBattle(new Angel(), 1);
            var defenderInBattle = new CreaturesInBattle(new Angel(), 1);

            var angelHitPointsAfterAngelAttack = 200 - 50;

            attackerInBattle.DealDamage(defenderInBattle);

            Assert.AreEqual(angelHitPointsAfterAngelAttack, defenderInBattle.TotalHitPoints);
        }
コード例 #5
0
        public void ThrowsArgumentNullException_WhenDefenderInBattleIsNull()
        {
            var attackerInBattle = new CreaturesInBattle(new Angel(), 1);

            Assert.Throws <ArgumentNullException>(() => attackerInBattle.DealDamage(null));
        }