Example #1
0
        public void Remove_ById_Test()
        {
            var   type  = ModifierType.Ability;
            short value = 1;
            var   bag   = new ModifierBag();
            var   id    = bag.Add(type, value);

            Assert.IsTrue(1 == bag.Count);
            var isRemoved = bag.Remove(id);

            Assert.IsTrue(isRemoved);
            Assert.AreEqual(0, bag.Count);
        }
Example #2
0
        public void Remove_ByModifierType_Test()
        {
            var bag = new ModifierBag();

            bag.Add(ModifierType.Ability, 0);
            bag.Add(ModifierType.Proficiency, 4);
            bag.Add(ModifierType.Circumstance, 1);
            bag.Add(ModifierType.Circumstance, -2);
            bag.Add(ModifierType.Status, -1);
            Assert.AreEqual(5, bag.Count);
            var numRemoved = bag.Remove(ModifierType.Circumstance);

            Assert.AreEqual(2, numRemoved);
            Assert.AreEqual(3, bag.Count);
            Assert.AreEqual(0, bag.Count(m => m.Type == ModifierType.Circumstance));
        }