Example #1
0
        public void Dispose_CanBeCalledMultipleTimes()
        {
            var delivery = new TopicDelivery(new Amqp.Message(), new List <IDelivery>());

            Should.NotThrow(() =>
            {
                delivery.Dispose();
                delivery.Dispose();
            });
        }
Example #2
0
        public void Wait_Throws_WhenObjectDisposed()
        {
            var delivery = new TopicDelivery(new Amqp.Message(), new List <IDelivery>());

            delivery.Dispose();

            Should.ThrowAsync <ObjectDisposedException>(delivery.WaitAsync(TimeSpan.Zero));
        }
Example #3
0
        public void Dispose_DoesNotThrow_WhenSubscriptionNotDisposable()
        {
            IDelivery subscription = Substitute.For <IDelivery>();
            var       delivery     = new TopicDelivery(new Amqp.Message(), new List <IDelivery> {
                subscription
            });

            Should.NotThrow(() => delivery.Dispose());
        }
Example #4
0
        public void Dispose_DisposesSubscriptions()
        {
            IDisposable subscription = Substitute.For <IDisposable, IDelivery>();
            var         delivery     = new TopicDelivery(new Amqp.Message(), new List <IDelivery> {
                (IDelivery)subscription
            });

            delivery.Dispose();

            subscription.Received(1).Dispose();
        }