public void TestOrdering() { FastScheduler.SetLogicalTime(DateTime.UnixEpoch); var t1 = new TestTask(TimeSpan.FromSeconds(1)); var t2 = new TestTask(TimeSpan.FromSeconds(2)); var t3 = new TestTask(TimeSpan.FromSeconds(3)); var minute = (long)FastScheduler.NowTimespan.TotalMinutes; var queue = FastScheduler.GetMinuteQueue(minute); Assert.AreEqual(t1, queue.First()); Assert.AreEqual(t3, queue.Last()); Assert.AreEqual(3, FastScheduler.PendingTasks); }
public void TestMinuteQueues() { var time = DateTime.UnixEpoch; FastScheduler.SetLogicalTime(time); var t1 = new TestTask(TimeSpan.FromSeconds(1)); var t2 = new TestTask(TimeSpan.FromSeconds(1 + 60)); var t3 = new TestTask(TimeSpan.FromSeconds(1 + 120)); var minute = (long)FastScheduler.NowTimespan.TotalMinutes; Assert.IsTrue(FastScheduler.GetMinuteQueue(minute).Contains(t1)); Assert.IsTrue(FastScheduler.GetMinuteQueue(minute + 1).Contains(t2)); Assert.IsTrue(FastScheduler.GetMinuteQueue(minute + 2).Contains(t3)); }