Ejemplo n.º 1
0
        public void FromXMLTest()
        {
            AttackCollectionValue target = new AttackCollectionValue();
            bool caughtException = false;

            try
            {
                target.FromXML(LoadableXML);
            }
            catch (System.Exception ex)
            {
                caughtException = true;
            }
            Assert.IsTrue(!caughtException, "Error creating FromXML");
            Assert.IsTrue(target.GetCurrentAttacks().Count == 3, "Incorrect Amount of attacks populated");
            Assert.IsTrue(target.GetCurrentPercentageApplied("Missile") == 100, "Incorrect Percentage Applied for Missile");

            target.FromXML("");
            Assert.IsTrue(target.GetCurrentAttacks().Count == 0, "Incorrect Amount of attacks populated");
            Assert.IsTrue(target.GetCurrentPercentageApplied("Missile") == 0, "Incorrect Percentage Applied for Missile");
        }
Ejemplo n.º 2
0
 public void RemoveAttackTest1()
 {
     AttackCollectionValue target = new AttackCollectionValue();
     target.FromXML(LoadableXML);
     AttackCollectionValue.AttackValue attack = null; 
     bool expected = true; 
     bool actual;
     int remainingCapabilityPercentage = 40;
     attack = target.GetCurrentAttacks()[1];
     actual = target.RemoveAttack(attack);
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(remainingCapabilityPercentage, target.GetCurrentAttacks()[1].percentageApplied);
 }
Ejemplo n.º 3
0
 public void RemoveAttackTest()
 {
     AttackCollectionValue target = new AttackCollectionValue();
     target.FromXML(LoadableXML);
     string capabilityName = "Missile"; 
     string targetObjectId = "MyTarget"; 
     string attackingObjectId = "MyAttacker"; 
     int attackStartTime = 8;
     int remainingCapabilityPercentage = 40;
     bool expected = true; 
     bool actual;
     actual = target.RemoveAttack(capabilityName, targetObjectId, attackingObjectId, attackStartTime);
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(remainingCapabilityPercentage, target.GetCurrentAttacks()[1].percentageApplied);
 }