Beispiel #1
0
        public void QueryTimeout_NoIncludeEvents_Works()
        {
            var rand   = new Random(1234);
            var queue  = new TestQueue();
            var counts = new Dictionary <FFXIVRole, int>
            {
                { FFXIVRole.DPS, 0 },
                { FFXIVRole.Healer, 0 },
                { FFXIVRole.Tank, 0 },
            };

            for (ulong i = 0; i < 1000; i++)
            {
                var nextRole = rand.Next(0, 3) switch
                {
                    0 => FFXIVRole.DPS,
                    1 => FFXIVRole.Healer,
                    2 => FFXIVRole.Tank,
                    _ => throw new NotImplementedException(),
                };
                counts[nextRole]++;
                queue.AddSlot(new QueueSlot(i, EventId)
                {
                    QueueTime = DateTime.UtcNow.AddHours(-5),
                }, nextRole);
            }

            var roles    = new[] { FFXIVRole.DPS, FFXIVRole.Healer, FFXIVRole.Tank };
            var timeouts = new Dictionary <FFXIVRole, IEnumerable <ulong> >();

            foreach (var role in roles)
            {
                timeouts[role] = queue.TryQueryTimeout(role, 4 * Time.Hour);
            }
            Assert.That(timeouts[FFXIVRole.DPS].Concat(timeouts[FFXIVRole.Healer]).Concat(timeouts[FFXIVRole.Tank]).Count() == 1000);
            Assert.That(!queue.GetAllSlots().Any());
        }