public void ToRetryPolicyWithCustomPolicyUsesTheCustomPolicy()
        {
            var options = new RetryOptions
            {
                Mode              = RetryMode.Fixed,
                MaximumRetries    = 65,
                Delay             = TimeSpan.FromSeconds(1),
                MaximumDelay      = TimeSpan.FromSeconds(2),
                TryTimeout        = TimeSpan.FromSeconds(3),
                CustomRetryPolicy = Mock.Of <EventHubsRetryPolicy>()
            };

            var policy = options.ToRetryPolicy();

            Assert.That(policy, Is.Not.Null, "The policy should not be null.");
            Assert.That(policy, Is.SameAs(options.CustomRetryPolicy), "The custom retry policy should have been used.");
            Assert.That(policy, Is.Not.InstanceOf <BasicRetryPolicy>(), "The default policy type should not have been generated.");
        }
        public void ToRetryPolicyWithoutCustomPolicyCreatesThePolicy()
        {
            var options = new RetryOptions
            {
                Mode              = RetryMode.Fixed,
                MaximumRetries    = 65,
                Delay             = TimeSpan.FromSeconds(1),
                MaximumDelay      = TimeSpan.FromSeconds(2),
                TryTimeout        = TimeSpan.FromSeconds(3),
                CustomRetryPolicy = null
            };

            var policy = options.ToRetryPolicy();

            Assert.That(policy, Is.Not.Null, "The policy should not be null.");
            Assert.That(policy, Is.InstanceOf <BasicRetryPolicy>(), "The options should produce a basic retry policy.");
            Assert.That(((BasicRetryPolicy)policy).Options, Is.SameAs(options), "The options should have been used for the retry policy.");
            Assert.That(policy, Is.Not.SameAs(options.CustomRetryPolicy), "The custom retry policy should not have been used, since it was not populated.");
        }