Exemplo n.º 1
0
        public void CreateTurnOrder_CheckForMultipleAttacks()
        {
            // arrange
            List<Combatant> combatants = new List<Combatant>();
            Combatant combatant1Copy = CopyCombatant(combatant1);
            combatant1Copy.Speed = 60;
            combatants.Add(combatant1Copy);
            combatants.Add(combatant2);
            combatants.Add(combatant3);

            Battle battleClass = new Battle();

            // act
            var turnOrder = battleClass.CreateTurnOrder(combatants);

            int turnOrderCount = 0;
            foreach (KeyValuePair<int, Combatant> pair in turnOrder)
            {
                turnOrderCount++;
            }

            // assert
            Assert.AreEqual(4, turnOrderCount, "CreateTurnOrder does not let combatant do multiple attacks");
        }
Exemplo n.º 2
0
        public void CreateTurnOrder_CheckSortedTurnOrder()
        {
            // arrange
            List<Combatant> combatants = new List<Combatant>();
            combatants.Add(combatant1);
            combatants.Add(combatant2);
            combatants.Add(combatant3);

            Battle battleClass = new Battle();

            // act
            var turnOrder = battleClass.CreateTurnOrder(combatants);
            int[] turnOrderInt = new int[3];
            int i = 0;

            // assert
            foreach (KeyValuePair<int, Combatant> pair in turnOrder)
            {
                turnOrderInt[i] = pair.Key;
                i++;
            }

            if (turnOrderInt[0] > turnOrderInt[1] && turnOrderInt[1] > turnOrderInt[2])
            {
                Assert.IsTrue(true);
                return;
            }
            Assert.Fail("CreateTurnOrder does not order the list correctly. Order: {0}, {1}, {2}", turnOrderInt[0], turnOrderInt[1], turnOrderInt[2]);
        }