Exemple #1
0
        public void CanEnqueueSystem()
        {
            var dummySystem = new DummySystem();

            this.TestSystem.EnqueueFirstSystem(dummySystem);
            Assert.IsTrue(this.TestSystem.HasRegisteredSystem(dummySystem));
        }
Exemple #2
0
        public void EnqueuedSystemsGetTicked()
        {
            var dummySystem = new DummySystem();

            this.TestSystem.EnqueueFirstSystem(dummySystem);
            this.TestSystem.Tick();
            Assert.AreEqual(1, dummySystem.TickCount);
        }
Exemple #3
0
        public void CanDeRegisterSystem()
        {
            var dummySystem = new DummySystem();

            this.TestSystem.EnqueueFirstSystem(dummySystem);
            this.TestSystem.DeRegisterSystem(dummySystem);
            Assert.False(this.TestSystem.HasRegisteredSystem(dummySystem));
        }
Exemple #4
0
        public void RemovedSystemsDontGetTicked()
        {
            var dummySystem1 = new DummySystem();
            var dummySystem2 = new DummySystem();

            this.TestSystem.EnqueueFirstSystem(dummySystem1);
            this.TestSystem.EnqueueFirstSystem(dummySystem2);
            this.TestSystem.Tick();
            this.TestSystem.DeRegisterSystem(dummySystem2);
            this.TestSystem.Tick();
            Assert.AreEqual(2, dummySystem1.TickCount);
            Assert.AreEqual(1, dummySystem2.TickCount);
        }
Exemple #5
0
        public void DeRegisterOnlyRemovesTheSpecificSystem()
        {
            var dummySystem1 = new DummySystem();
            var dummySystem2 = new DummySystem();
            var dummySystem3 = new DummySystem();

            this.TestSystem.EnqueueFirstSystem(dummySystem1);
            this.TestSystem.EnqueueFirstSystem(dummySystem2);
            this.TestSystem.EnqueueFirstSystem(dummySystem3);
            this.TestSystem.DeRegisterSystem(dummySystem2);
            Assert.IsTrue(this.TestSystem.HasRegisteredSystem(dummySystem3));
            Assert.IsTrue(this.TestSystem.HasRegisteredSystem(dummySystem1));
        }
Exemple #6
0
        /// <summary>
        /// Will use the <see cref="DummySystem"/> to cast the given buffing ability on the target and then track it to synchronise removal.
        /// </summary>
        /// <param name="abilityId">The ability ID which applies the buff that should be tracked</param>
        /// <param name="buffId">The buff ID to track</param>
        /// <param name="orderId">The order ID of the ability to cast</param>
        /// <param name="level">The level of the ability to cast</param>
        /// <param name="dummyPlayer">Who the owner of the dummy should be set to, defaults to Neutral Passive</param>
        public void Bind(int abilityId, int buffId, int orderId, int level = 1, player dummyPlayer = null)
        {
            dummyPlayer ??= Player(PLAYER_NEUTRAL_PASSIVE);
            var dummy = DummySystem.GetDummy();

            SetUnitOwner(dummy, dummyPlayer, true);
            UnitAddAbility(dummy, abilityId);
            SetUnitAbilityLevel(dummy, abilityId, level);
            IssueTargetOrderById(dummy, orderId, Target);
            DummySystem.RecycleDummy(dummy);

            this.buffId = buffId;
        }
Exemple #7
0
        public void SystemsGetTickedInOrder()
        {
            var dummySystem1 = new DummySystem();
            var dummySystem2 = new DummySystem();
            var tickList     = new List <DummySystem>();

            this.TestSystem.EnqueueFirstSystem(dummySystem1);
            this.TestSystem.EnqueueFirstSystem(dummySystem2);
            dummySystem1.Ticked += () => { tickList.Add(dummySystem1); };
            dummySystem2.Ticked += () => { tickList.Add(dummySystem2); };
            this.TestSystem.Tick();
            Assert.AreEqual(dummySystem1, tickList[0]);
            Assert.AreEqual(dummySystem2, tickList[1]);
        }
Exemple #8
0
        public void SystemsStayInOrderAfterRemoveOne()
        {
            var dummySystem1 = new DummySystem(1);
            var dummySystem2 = new DummySystem(2);
            var dummySystem3 = new DummySystem(3);
            var dummySystem4 = new DummySystem(4);

            this.TestSystem.EnqueueFirstSystem(dummySystem1);
            this.TestSystem.EnqueueFirstSystem(dummySystem2);
            this.TestSystem.EnqueueFirstSystem(dummySystem3);
            this.TestSystem.EnqueueFirstSystem(dummySystem4);
            this.TestSystem.DeRegisterSystem(dummySystem3);
            Assert.AreEqual(dummySystem4, this.TestSystem.DequeueLastSystem());
            Assert.AreEqual(dummySystem2, this.TestSystem.DequeueLastSystem());
            Assert.AreEqual(dummySystem1, this.TestSystem.DequeueLastSystem());
        }