Пример #1
0
        public void TestClassList()
        {
            ClassList classList = new ClassList("races");

            classList.AddClass(new Class("dwarf",
                                         new AttributeModifier(AttributeModifier.AttributeModifierOptions.SET, "use_hammer"),
                                         new AttributeModifier(AttributeModifier.AttributeModifierOptions.FORBID, "use_bow")
                                         ));

            classList.AddClass(new Class("elf",
                                         new AttributeModifier(AttributeModifier.AttributeModifierOptions.SET, "use_bow")
                                         ));

            Assert.IsTrue(classList.IsClassExisting("dwarf"));
            Assert.IsTrue(classList.IsClassExisting("elf"));
            Assert.IsFalse(classList.IsClassExisting("human"));

            Class dwarf = classList.GetClassByName("dwarf");
            Class elf   = classList.GetClassByName("elf");

            Assert.IsTrue(dwarf.ContainsAttributeModifier("use_hammer"));
            Assert.IsTrue(dwarf.ContainsAttributeModifier("use_bow"));

            Assert.AreEqual(dwarf.GetAttributeModifier("use_bow").Option, AttributeModifier.AttributeModifierOptions.FORBID);
        }