Exemple #1
0
        public void Insert_Works_Event(FFXIVRole role)
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, role, EventId);
            queue.Insert(UserId, 0, role);
            Assert.AreEqual(1, queue.GetPosition(UserId, role, EventId));
        }
Exemple #2
0
        public void Shove_Works_Event(FFXIVRole role)
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(userId, role, eventId);
            queue.Shove(userId, role);
            Assert.AreEqual(1, queue.GetPosition(userId, role, eventId));
        }
Exemple #3
0
        public void Shove_Works_NoEvent(FFXIVRole role)
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, role, "");
            queue.Shove(UserId, role);
            Assert.AreEqual(1, queue.GetPosition(UserId, role, null));
        }
Exemple #4
0
        public void Insert_Works_NoEvent(FFXIVRole role)
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(userId, role, "");
            queue.Insert(userId, 0, role);
            Assert.AreEqual(1, queue.GetPosition(userId, role, null));
        }
Exemple #5
0
        public void Queue_NoneRole_FailsGracefully()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.None, null);
            Assert.AreEqual(0, queue.GetPosition(UserId, FFXIVRole.None, null));
            Assert.AreEqual(0, queue.GetPosition(UserId, FFXIVRole.DPS, null));
            Assert.AreEqual(0, queue.GetPosition(UserId, FFXIVRole.Healer, null));
            Assert.AreEqual(0, queue.GetPosition(UserId, FFXIVRole.Tank, null));
        }
Exemple #6
0
        public void SetEvent_Works(FFXIVRole role)
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(userId, role, eventId);
            queue.SetEvent(userId, role, null);
            var userEventId = queue.GetEvent(userId, role);

            Assert.That(string.IsNullOrEmpty(userEventId));
        }
Exemple #7
0
        public void Remove_Old_Works()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, EventId);
            queue.Remove(UserId, FFXIVRole.DPS);
            var userId = queue.Dequeue(FFXIVRole.DPS, EventId);

            Assert.Null(userId);
        }
Exemple #8
0
        public void GetEventSlots_DoesNothing_NoEvent()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, EventId);
            queue.Enqueue(0, FFXIVRole.Tank, EventId);
            queue.Enqueue(1, FFXIVRole.Healer, null);
            queue.Enqueue(2, FFXIVRole.Healer, EventId);
            queue.Enqueue(3, FFXIVRole.Tank, null);
            Assert.IsEmpty(queue.GetEventSlots(null));
        }
Exemple #9
0
        public void GetEventSlots_Works_Event()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, EventId);
            queue.Enqueue(0, FFXIVRole.Tank, EventId);
            queue.Enqueue(1, FFXIVRole.Healer, EventId);
            queue.Enqueue(2, FFXIVRole.Healer, EventId);
            queue.Enqueue(3, FFXIVRole.Tank, EventId);
            Assert.IsNotEmpty(queue.GetEventSlots(EventId));
        }
Exemple #10
0
        public void Dequeue_Normal_PullsForNormal(FFXIVRole role)
        {
            var queue          = new FFXIV3RoleQueue();
            var enqueueSuccess = queue.Enqueue(userId, role, null);

            Assert.IsTrue(enqueueSuccess);

            var outUId = queue.Dequeue(role, null);

            Assert.IsNotNull(outUId);
        }
Exemple #11
0
        public void Dequeue_Event_PullsForEvent(FFXIVRole role)
        {
            var queue          = new FFXIV3RoleQueue();
            var enqueueSuccess = queue.Enqueue(userId, role, eventId);

            Assert.IsTrue(enqueueSuccess);

            var outUId = queue.Dequeue(role, eventId);

            Assert.IsNotNull(outUId);
        }
Exemple #12
0
        public void Queue_NoParameters_MaintainsState_EmptyEvent(FFXIVRole role)
        {
            var queue          = new FFXIV3RoleQueue();
            var enqueueSuccess = queue.Enqueue(UserId, role, "");

            Assert.IsTrue(enqueueSuccess);
            var outUId = queue.Dequeue(role, "");

            Assert.IsTrue(outUId.HasValue);
            Assert.AreEqual(UserId, outUId.Value);
        }
Exemple #13
0
        public void Dequeue_Normal_DoesNotPullForEvent(FFXIVRole role)
        {
            var queue          = new FFXIV3RoleQueue();
            var enqueueSuccess = queue.Enqueue(UserId, role, EventId);

            Assert.IsTrue(enqueueSuccess);

            var outUId = queue.Dequeue(role, null);

            Assert.IsNull(outUId);
        }
Exemple #14
0
        public void CountDistinct_Normal_Works()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, null);
            queue.Enqueue(UserId, FFXIVRole.Healer, "");
            queue.Enqueue(39284729857983498, FFXIVRole.DPS, "");
            queue.Enqueue(39284729857983498, FFXIVRole.Tank, "");
            queue.Enqueue(11859824769135435, FFXIVRole.Healer, null);
            queue.Enqueue(23147289374928357, FFXIVRole.Healer, EventId);
            Assert.AreEqual(3, queue.CountDistinct(null));
        }
Exemple #15
0
        public void GetEvents_Works_1()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, EventId);
            queue.Enqueue(0, FFXIVRole.Tank, EventId);
            queue.Enqueue(1, FFXIVRole.Healer, EventId);
            queue.Enqueue(2, FFXIVRole.Healer, null);
            queue.Enqueue(3, FFXIVRole.Tank, "");

            var eventIds = queue.GetEvents().ToList();

            Assert.That(eventIds.Count == 1);
            Assert.That(eventIds[0] == EventId);
        }
Exemple #16
0
        public void GetEvents_Works_2()
        {
            var queue = new FFXIV3RoleQueue();

            queue.Enqueue(UserId, FFXIVRole.DPS, EventId);
            queue.Enqueue(0, FFXIVRole.Tank, "b");
            queue.Enqueue(1, FFXIVRole.Healer, "a");
            queue.Enqueue(2, FFXIVRole.Healer, null);
            queue.Enqueue(3, FFXIVRole.Tank, "");

            var eventIds = queue.GetEvents().ToList();

            Assert.IsNotNull(eventIds.FirstOrDefault(eId => eId == EventId));
            Assert.IsNotNull(eventIds.FirstOrDefault(eId => eId == "b"));
            Assert.IsNotNull(eventIds.FirstOrDefault(eId => eId == "a"));
        }
Exemple #17
0
        public void Queue_EventId_NotCountedNormally(FFXIVRole role)
        {
            var queue          = new FFXIV3RoleQueue();
            var enqueueSuccess = queue.Enqueue(UserId, role, EventId);

            Assert.IsTrue(enqueueSuccess);

            var pos1 = queue.GetPosition(UserId, role, null);

            Assert.AreEqual(0, pos1);
            var pos2 = queue.GetPosition(UserId, role, EventId);

            Assert.AreEqual(1, pos2);

            var count1 = queue.Count(role, null);

            Assert.AreEqual(0, count1);
            var count2 = queue.Count(role, EventId);

            Assert.AreEqual(1, count2);
        }