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

            Should.NotThrow(() =>
            {
                delivery.Dispose();
                delivery.Dispose();
            });
        }
예제 #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));
        }
예제 #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());
        }
예제 #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();
        }