public void Dispose_CanBeCalledMultipleTimes() { var delivery = new TopicDelivery(new Amqp.Message(), new List <IDelivery>()); Should.NotThrow(() => { delivery.Dispose(); delivery.Dispose(); }); }
public void Wait_Throws_WhenObjectDisposed() { var delivery = new TopicDelivery(new Amqp.Message(), new List <IDelivery>()); delivery.Dispose(); Should.ThrowAsync <ObjectDisposedException>(delivery.WaitAsync(TimeSpan.Zero)); }
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()); }
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(); }