Пример #1
0
        public void ProcessingQueueEnqueueOperationThrowsIfTaskCollectionContainsNull()
        {
            var queue = new ThrottledProcessingQueue();

            Task[] tasks = new[] { new Task(() => { }), null, new Task(() => { }) };

            Assert.Throws <ArgumentException>(() => queue.RegisterOperations(tasks));
        }
Пример #2
0
        public void ProcessingQueueStartsOperationIfProcessQueueIsNotFull()
        {
            bool operationProcessed = false;

            var queue = new ThrottledProcessingQueue();

            Task operation = new Task(() =>
            {
                operationProcessed = true;
            });

            queue.RegisterOperations(new[] { operation });

            operation.Wait();

            Assert.IsTrue(operationProcessed);
        }
Пример #3
0
        public void ProcessingQueueEnqueueOperationThrowsIfTasksCollectionIsNull()
        {
            var queue = new ThrottledProcessingQueue();

            Assert.Throws <ArgumentNullException>(() => queue.RegisterOperations(null as Task[]));
        }