예제 #1
0
        public void ProcessAsync_ExceptionWhileProcessingItem_ThrowExceptionAndUpdatesItem()
        {
            var queue          = new SingleItemStatefulQueue(new StringItem("An item"));
            var handler        = new ThrowExceptionPayloadHandler(new Exception("An exception"));
            var queueProcessor = new StatefulQueueProcessor <string>(queue, handler);

            Assert.ThrowsAsync <Exception>(() => queueProcessor.ProcessAsync());
            Assert.IsTrue(queue.UpdateWasCalled);
        }
예제 #2
0
        public async Task ProcessAsync_NoExceptionWhileProcessingItem_UpdatesItem()
        {
            var queue          = new SingleItemStatefulQueue(new StringItem("An item"));
            var handler        = new FakePayloadHandler();
            var queueProcessor = new StatefulQueueProcessor <string>(queue, handler);

            await queueProcessor.ProcessAsync();

            Assert.IsTrue(queue.UpdateWasCalled);
        }
예제 #3
0
        public async Task ProcessAsync_AnItemInQueue_ReturnsTrue()
        {
            var queue          = new SingleItemStatefulQueue(new StringItem("An item"));
            var handler        = new FakePayloadHandler();
            var queueProcessor = new StatefulQueueProcessor <string>(queue, handler);

            var processed = await queueProcessor.ProcessAsync();

            Assert.IsTrue(processed);
        }