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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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)); }
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); }
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")); }
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); }