Exemple #1
0
 private async Task RemoveItemsFromQueueAsync(List <OrderItem> orderItems)
 {
     //The method RemoveItemFromQueue can create much garbage in the heap memory and give much work
     //to the garbage collector, but I am counting it won't be called frequently.
     //There is a better way to handle queueItems removal.
     foreach (var item in orderItems)
     {
         await queuingHandler.RemoveItemFromQueue(item.KitchenArea, item);
     }
 }
        public async Task RemoveItemFromQueueShouldRemoveItemSuccessfully()
        {
            string queueId2 = "Q2";

            queuingHandler.AddItemToQueue(queueId2, new DummyQueueItem {
                Id = 3
            }).Wait();
            var dummyQueueItem = new DummyQueueItem
            {
                Id = 2
            };

            await queuingHandler.RemoveItemFromQueue(queueId2, dummyQueueItem);

            Assert.That(queuingHandler.QueuesRecord[queueId2].Contains(dummyQueueItem), Is.False);
        }