예제 #1
0
        public void SetThiefLevelTest()
        {
            Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>();

            dict.Add(Dungeons_and_Dragons.Attribute.Strength, 15);
            dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 10);
            dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 3);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 8);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int   xp    = 0;
            int   hp    = 3;
            Thief thief = new Thief("Stickie", Race.Elf, dict, hp, xp);

            thief.IncreaseExperiencePoints(0);

            Assert.AreEqual(1, thief.currentLevel, "TEST1: The level is not as expected");

            thief.IncreaseExperiencePoints(1199);

            Assert.AreEqual(1, thief.currentLevel, "TEST2: The level is not as expected");

            thief.IncreaseExperiencePoints(1);

            Assert.AreEqual(2, thief.currentLevel, "TEST3: The level is not as expected");

            thief.IncreaseExperiencePoints(1199);

            Assert.AreEqual(2, thief.currentLevel, "TEST4: The level is not as expected");

            thief.IncreaseExperiencePoints(1);

            Assert.AreEqual(3, thief.currentLevel, "TEST5: The level is not as expected");
        }
예제 #2
0
        public void TestIncreaseExperiencePoints_WithAPositive5PercentModifier()
        {
            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, 18);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int       xp        = 0;
            int       hp        = 4;
            Character character = new Thief("Mo", Race.Elf, dict, hp, xp);

            character.SetExperiencePointMultiplier(5);

            character.IncreaseExperiencePoints(100);

            Assert.AreEqual(105, character.experiencePoints, "TEST1: The number of Experience Points returned was not as expected");
        }