Exemplo n.º 1
0
        public void Process_DoesNotProcessDeliveryIfItDoesntExist()
        {
            var message = new Message();

            message.InitializePrivateProperty("Delivery");
            ListenerLink   link           = Construct.Uninitialized <ListenerLink>();
            MessageContext messageContext = Construct.ForPrivate <MessageContext>(link, message);
            var            queue          = new DeliveryQueue();

            Should.NotThrow(() => queue.Process(messageContext));
        }
Exemplo n.º 2
0
        public void Dispose_DisposesQueue()
        {
            var delivery = new Delivery(new Message());
            var queue    = new DeliveryQueue();

            queue.Dispose();

            Should.Throw <ObjectDisposedException>(() => queue.Enqueue(delivery));
            Should.Throw <ObjectDisposedException>(() => queue.Dequeue(CancellationToken.None));
            Should.Throw <ObjectDisposedException>(() => queue.Process(null));
        }
Exemplo n.º 3
0
        public void Process_ProcessesDelivery()
        {
            var message = new Message();

            message.InitializePrivateProperty("Delivery");
            ListenerLink   link           = Construct.Uninitialized <ListenerLink>();
            MessageContext messageContext = Construct.ForPrivate <MessageContext>(link, message);
            var            delivery       = new Delivery(message);
            var            queue          = new DeliveryQueue();

            queue.Enqueue(delivery);
            queue.Dequeue(CancellationToken.None);

            queue.Process(messageContext);

            delivery.Processed.ShouldNotBeNull();
        }