Ejemplo n.º 1
0
        public void CloseConsumerLinkIgnoresGeneralExceptions(Exception terminalException)
        {
            var eventHub     = "fake-hub";
            var link         = new ReceivingAmqpLink(new AmqpLinkSettings());
            var mockConsumer = new MockAmqpConsumer(eventHub, true, terminalException);

            try
            {
                mockConsumer.InvokeCloseConsumerLink(link);
                Assert.That(GetActivePartitionStolenException(mockConsumer), Is.Null);
            }
            finally
            {
                link?.SafeClose();
            }
        }
Ejemplo n.º 2
0
        public void CloseConsumerLinkDetectsAStolenPartition()
        {
            var eventHub          = "fake-hub";
            var terminalException = new AmqpException(new Error {
                Condition = AmqpErrorCode.Stolen
            });
            var link         = new ReceivingAmqpLink(new AmqpLinkSettings());
            var mockConsumer = new MockAmqpConsumer(eventHub, true, terminalException);

            try
            {
                mockConsumer.InvokeCloseConsumerLink(link);
                Assert.That(GetActivePartitionStolenException(mockConsumer), Is.SameAs(terminalException));
            }
            finally
            {
                link?.SafeClose();
            }
        }