Exemplo n.º 1
0
        public void TestAddToCharactersInventory()
        {
            int initialItemsInInvetory = 0;
            int OneItemInInventory     = 1;

            Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>();

            dict.Add(Dungeons_and_Dragons.Attribute.Strength, 12);
            dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 15);
            dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 7);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 14);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int       xp        = 0;
            int       hp        = 2;
            Character character = new MagicUser("Morris", Race.Halfling, dict, hp, xp);

            ShortSword shortSword = new ShortSword();

            Assert.AreEqual(initialItemsInInvetory, character.inventory.Count, "TEST1: The number of items in the character's inventory is not as expected");

            character.AddToCharactersInventory(shortSword);

            Assert.AreEqual(OneItemInInventory, character.inventory.Count, "TEST2: The number of items in the character's inventory is not as expected");
        }