public void HeroGainsExperienceAfterAttackIfTargetDies()
        {
            // Arrange
            var fakeTarget = new FakeDeadTarget();
            var fakeWeapon = new FakeWeapon();
            var hero       = new Hero(HeroName, fakeWeapon);

            // Act
            hero.Attack(fakeTarget);
            var expectedExperience = fakeTarget.GiveExperience();

            // Assert
            Assert.AreEqual(expectedExperience, hero.Experience);
        }
Ejemplo n.º 2
0
        public void HeroGainsExperienceAfterKillingTarget()
        {
            //Arrange
            FakeTarget fakeTarget = new FakeTarget(TargetHealth, TargetExperience);
            FakeWeapon fakeWeapon = new FakeWeapon(WeaponDamage, WeaponDurability);
            Hero       hero       = new Hero(HeroName, fakeWeapon);

            //Act
            while (!fakeTarget.IsDead())
            {
                hero.Attack(fakeTarget);
            }

            //Assert
            Assert.AreEqual(TargetExperience, hero.Experience, "Hero doesn't gain experience after killing a target.");
        }