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(); } }
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(); } }