public void TranslateConnectionCloseDuringLinkCreationExceptionIgnoresNonMatchingInvalidOperationExceptions(string sourceMessage)
        {
            var sourceException = new InvalidOperationException(sourceMessage);
            var exception       = sourceException.TranslateConnectionCloseDuringLinkCreationException("dummy");

            Assert.That(exception, Is.SameAs(sourceException), "The exception should not have been translated.");
        }
        public void TranslateConnectionCloseDuringLinkCreationExceptionDetectsTheConnectionClosedInvalidOperationException()
        {
            var sourceException = new InvalidOperationException("Can't create session when the connection is closing");
            var exception       = (sourceException.TranslateConnectionCloseDuringLinkCreationException("dummy") as EventHubsException);

            Assert.That(exception, Is.Not.Null, "The exception should have been translated to an Event Hubs exception.");
            Assert.That(exception.IsTransient, Is.True, "The translation exception should allow retries.");
            Assert.That(exception.Reason, Is.EqualTo(EventHubsException.FailureReason.ServiceCommunicationProblem), "The translated exception should have the correct failure reason.");
            Assert.That(exception.InnerException, Is.EqualTo(sourceException), "The translated exception should wrap the source exception.");
        }