Beispiel #1
0
        public void AttackCleanUp_RemoveLowHealth()
        {
            // arrange
            List<Combatant> combatants = new List<Combatant>();
            Combatant combatant1Copy = CopyCombatant(combatant1);
            combatant1Copy.Health = 0;
            Combatant combatant2Copy = CopyCombatant(combatant2);
            combatant2Copy.Health = 0;
            combatants.Add(combatant1Copy);
            combatants.Add(combatant2Copy);

            Battle battleClass = new Battle();

            // act
            battleClass.AttackCleanUp(ref combatant1Copy, ref combatant2Copy, ref combatants);

            // assert
            if (combatants.Exists(x => x.CombatantID == combatant1Copy.CombatantID))
            {
                Assert.Fail("AttackCleanUp failed to remove the attacker with low stanima");
                return;
            }
            if (combatants.Exists(x => x.CombatantID == combatant2Copy.CombatantID))
            {
                Assert.Fail("AttackCleanUp failed to remvoe the defender with low stanima");
                return;
            }
            Assert.IsTrue(true);
        }
Beispiel #2
0
        public void AttackCleanUp_NoRemoval()
        {
            // arrange
            List<Combatant> combatants = new List<Combatant>();
            Combatant combatant1Copy = CopyCombatant(combatant1);
            Combatant combatant2Copy = CopyCombatant(combatant2);
            combatants.Add(combatant1Copy);
            combatants.Add(combatant2Copy);

            Battle battleClass = new Battle();

            // act
            battleClass.AttackCleanUp(ref combatant1Copy, ref combatant2Copy, ref combatants);

            // assert
            if(combatant1Copy.Stanima == combatant1Copy.MaxStanima - 1 &&
                combatant2Copy.Stanima == combatant2Copy.MaxStanima - 1 &&
                combatants.Exists(x => x.CombatantID == combatant1Copy.CombatantID) &&
                combatants.Exists(x => x.CombatantID == combatant2Copy.CombatantID))
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.Fail("AttackCleanUp removes combatants it's not supposed to remove");
            }
        }