Example #1
0
        public void Test_GetQueue_Test()
        {
            var defaultQueueA = _taskQueueManager.GetQueue();
            var defaultQueueB = _taskQueueManager.GetQueue();

            defaultQueueA.ShouldBe(defaultQueueB);

            var testQueueA1 = _taskQueueManager.CreateQueue("TestQueueA");
            var testQueueA2 = _taskQueueManager.GetQueue("TestQueueA");

            testQueueA1.ShouldBe(testQueueA2);
            testQueueA1.ShouldNotBe(defaultQueueA);

            var testQueueB1 = _taskQueueManager.CreateQueue("TestQueueB");
            var testQueueB2 = _taskQueueManager.GetQueue("TestQueueB");

            testQueueB1.ShouldBe(testQueueB2);
            testQueueB1.ShouldNotBe(defaultQueueA);
            testQueueB1.ShouldNotBe(testQueueA1);

            _taskQueueManager.Dispose();
        }
Example #2
0
 private void DisposeQueue()
 {
     _taskQueueManager.GetQueue(KernelConsts.UpdateChainQueueName).Dispose();
 }
Example #3
0
 public static void Enqueue(this ITaskQueueManager taskQueueManager, Func <Task> task, string name = null)
 {
     taskQueueManager.GetQueue(name).Enqueue(task);
 }
Example #4
0
        public void Test_StartAsync()
        {
            var testQueue = _taskQueueManager.GetQueue("TestQueue");

            testQueue.StartAsync().ShouldThrow <InvalidOperationException>();

            testQueue.StopAsync();
            Assert.Throws <InvalidOperationException>(() => testQueue.Enqueue(async() => { }));
        }