Exemple #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");
        }
Exemple #2
0
        public void GetCurrentPercentageAppliedTest()
        {
            AttackCollectionValue target = new AttackCollectionValue();
            string capabilityName        = "Missile";

            target.FromXML(LoadableXML);
            int expected = 100;
            int actual;

            actual = target.GetCurrentPercentageApplied(capabilityName);
            Assert.AreEqual(expected, actual);

            capabilityName = "Guns";
            expected       = 80;
            actual         = target.GetCurrentPercentageApplied(capabilityName);
            Assert.AreEqual(expected, actual);

            capabilityName = "Nonexistant";
            expected       = 0;
            actual         = target.GetCurrentPercentageApplied(capabilityName);
            Assert.AreEqual(expected, actual);
        }