示例#1
0
        public void PlayerDrinkPotionDisplayMessageTest()
        {
            OutputHelper.Display.ClearUserOutput();
            player.Inventory.Add(potion);
            string displayMessage = $"You drank a potion and replenished {potion.HealthAmount} health.";

            potion.DrinkPotion(player);

            Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]);
        }
示例#2
0
        public void PlayerDrinkPotionPartialHealthTest()
        {
            potion = new HealthPotion(PotionStrength.Greater);              // Greater health potion restores 150 health
            player.Inventory.Add(potion);
            player.MaxHitPoints = 200;
            player.HitPoints    = 100;

            potion.DrinkPotion(player);

            Assert.AreEqual(player.MaxHitPoints, player.HitPoints);
        }
示例#3
0
        public void PlayerDrinkPotionFullHealthTest()
        {
            potion = new HealthPotion(PotionStrength.Greater);              // Greater health potion restores 150 health
            player.Inventory.Add(potion);
            player.MaxHitPoints = 200;
            player.HitPoints    = 25;
            int oldPlayerHP = player.HitPoints;

            potion.DrinkPotion(player);

            Assert.AreEqual(oldPlayerHP + potion.HealthAmount, player.HitPoints);
        }