Exemplo n.º 1
0
        public void Queue_AfterQueueTasks_ThenTryDequeue()
        {
            var scheduler = new TestableScheduler()
            {
                IsReliable = true
            };
            var task0 = ATask();
            var task1 = ATask();
            var task2 = ATask();

            scheduler.QueueTask(task0);
            scheduler.QueueTask(task1);
            scheduler.QueueTask(task2);
            scheduler.TryDequeue(task1).Should().BeTrue();
            scheduler.TryDequeue(task1).Should().BeFalse();

            scheduler.GetScheduledTasks().Should().BeEquivalentTo(task0, task2);
            scheduler.TryStartDispatcherCount.Should().Be(3);
        }
Exemplo n.º 2
0
        public void Queue_Initial_ThenTryDequeue()
        {
            var scheduler = new TestableScheduler()
            {
                IsReliable = true
            };

            scheduler.TryDequeue(ATask()).Should().BeFalse();

            scheduler.GetScheduledTasks().Should().BeEmpty();
            scheduler.TryStartDispatcherCount.Should().Be(0);
        }