Exemplo n.º 1
0
        public void TestUpgradeFightingPower()
        {
            Hero superman = new Superman();
            int  temp     = superman.UsePower("Punch");

            superman.UpgradeFightingPower("Punch", 10);
            Assert.AreEqual(superman.UsePower("Punch"), temp + 10);
            Assert.Throws <InvalidPowerException>(() => superman.UpgradeFightingPower("Fly", 10));
            Assert.Throws <InvalidPowerException>(() => superman.UpgradeFightingPower("Sit down", 10));
        }
Exemplo n.º 2
0
        public void TestEquality()
        {
            Hero superman  = new Superman();
            Hero clarkkent = new Superman();

            Assert.AreEqual(superman, clarkkent);
            Hero wonderwoman = new Wonderwoman();

            Assert.AreNotEqual(superman, wonderwoman);
        }
Exemplo n.º 3
0
        public void TestLearnPower()
        {
            Hero superman = new Superman();

            superman.LearnNeutralPower("Jump");
            Assert.AreEqual(superman.UsePower("Jump"), 0);
            superman.LearnFightingPower("Kick");
            Assert.AreEqual(superman.UsePower("Kick"), 1);
            Assert.Throws <ExistingPowerException>(() => superman.LearnNeutralPower("Fly"));
        }