コード例 #1
0
        public void BreakingAndRepairing()
        {
            Character Guinevere = new Character("Guinevere", new Knight("F"));

            EquipmentItem brokenSword = ItemDAO.CreateNewEquipmentItem("Longsword");

            brokenSword.ItemName = "Broken Sword";
            brokenSword.DamageEquipment(100);

            Guinevere.Inventory.AddItem(brokenSword);

            Assert.IsTrue(brokenSword.Condition == 0,
                          "Broken weapon's durability should be 0.");

            Assert.IsTrue(brokenSword.EquipmentTags.Contains("Broken"),
                          "Equipment item should have the broken keyword.");

            Assert.IsFalse(Guinevere.Equipment.Equip("OffHand", "Broken Sword"),
                           "Broken gear should not be equippable.");

            brokenSword.RepairEquipment(5);

            Assert.IsFalse(brokenSword.EquipmentTags.Contains("Broken"),
                           "Equipment item should no longer be broken.");

            Assert.IsTrue(Guinevere.Equipment.Equip("OffHand", "Broken Sword"),
                          "Sword should no longer be broken.");
        }