Example #1
0
        public void CastSpell_FocusSpell_FiveEventsOnCasterAndOneEventOnTarget()
        {
            var caster = NewFakePlayer();
            var target = NewFakePlayer();
            var spell  = NewFakeSpell();

            spell.fakeIsFocus = true;
            spell.fakeTarget  = "Realm";
            spell.Duration    = 20;
            var spellHandler    = new SpellHandler(caster, spell, NewSpellLine());
            var gameEventMgrSpy = GameEventMgrSpy.LoadAndReturn();

            UtilChanceIsHundredPercent.Enable();

            spellHandler.CastSpell(target);

            var eventNumberOnCaster = gameEventMgrSpy.GameObjectEventCollection[caster].Count;
            var eventNumberOnTarget = gameEventMgrSpy.GameObjectEventCollection[target].Count;

            Assert.AreEqual(5, eventNumberOnCaster, "Caster has not the right amount of event subscriptions");
            Assert.AreEqual(1, eventNumberOnTarget, "Target has not the right amount of event subscriptions");
        }
Example #2
0
        public void CastSpell_FocusSpellAndCasterMoves_AllEventsRemoved()
        {
            var caster = NewFakePlayer();
            var target = NewFakeNPC();
            var spell  = NewFakeSpell();

            spell.fakeIsFocus = true;
            spell.fakeTarget  = "realm";
            spell.Duration    = 20;
            var spellHandler    = new SpellHandler(caster, spell, NewSpellLine());
            var gameEventMgrSpy = GameEventMgrSpy.LoadAndReturn();

            FakeServer.LoadAndReturn().FakeServerRules.fakeIsAllowedToAttack = false;
            UtilChanceIsHundredPercent.Enable();

            spellHandler.CastSpell(target);
            caster.OnPlayerMove();

            var eventNumberOnCaster = gameEventMgrSpy.GameObjectEventCollection[caster].Count;
            var eventNumberOnTarget = gameEventMgrSpy.GameObjectEventCollection[target].Count;

            Assert.AreEqual(0, eventNumberOnCaster, "Caster has not the right amount of event subscriptions");
            Assert.AreEqual(0, eventNumberOnTarget, "Target has not the right amount of event subscriptions");
        }