Exemplo n.º 1
0
        public void TestEquipToHand_EnsureArmourClassIsCorrectAShieldButNoArmourOrBonus()
        {
            int expectedArmourClass = 8;

            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, 10);
            dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 3);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 12);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 1);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int    xp     = 0;
            int    hp     = 1;
            Cleric cleric = new Cleric("Fryer Ben", Race.Halfling, dict, hp, xp);

            Shield shield = new Shield();

            bool valEquipped = cleric.EquipToHand(shield, Hand.Left);

            Assert.IsTrue(valEquipped, "TEST1: It was expected that equipping shield returns true");
            Assert.AreEqual(expectedArmourClass, cleric.armourClass, "The Cleric's expected AC was 8");
        }
Exemplo n.º 2
0
        public void TestEquipToHand_WhereWeaponIsNotUseableByACleric()
        {
            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, 3);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 12);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int    xp     = 0;
            int    hp     = 1;
            Cleric cleric = new Cleric("Fryer Ben", Race.Halfling, dict, hp, xp);

            Sword sword = new Sword();

            Assert.IsNull(cleric.equippedInRightHand, "TEST1: It was expected that nothing should be equipped to the Cleric's right hand");

            bool val = cleric.EquipToHand(sword, Hand.Right);

            Assert.IsFalse(val, "TEST2: It was expected equipping the sword to the right hand should return false");
            Assert.IsNull(cleric.equippedInRightHand, "TEST3: It was expected that the right hand is empty");
            Assert.IsNull(cleric.equippedInLeftHand, "TEST4: It was expected that the left hand is empty");
        }