Exemple #1
0
        public void TestPotion()
        {
            IHealthModifier badPotion  = new SimplePotion("Bad potion", -20);
            IHealthModifier goodPotion = new SimplePotion("GoodPotion", 15);

            badPotion.UseOn(PLAYER);
            goodPotion.UseOn(PLAYER);
            Assert.AreEqual(PLAYER.Health, 95);
        }
Exemple #2
0
        public void TestHealthOverflow()
        {
            IHealthModifier goodPotion = new SimplePotion("GoodPotion", 20);

            for (int i = 0; i < 6; i++)
            {
                goodPotion.UseOn(PLAYER);
            }
            Assert.AreEqual(PLAYER.Health, 100);
        }
Exemple #3
0
        public void TestHealthUnderflow()
        {
            IHealthModifier badPotion = new SimplePotion("Bad potion", -20);

            for (int i = 0; i < 6; i++)
            {
                badPotion.UseOn(PLAYER);
            }
            Assert.AreEqual(PLAYER.Health, 0);
            Assert.IsFalse(PLAYER.IsAlive());
        }