Exemple #1
0
        public void UpdateRetryPolicyUpdatesTheRetryPolicy()
        {
            var newPolicy = new BasicRetryPolicy(new RetryOptions {
                Delay = TimeSpan.FromMilliseconds(50)
            });
            var client = new AmqpEventHubClient("my.eventhub.com", "somePath", Mock.Of <TokenCredential>(), new EventHubClientOptions(), Mock.Of <EventHubRetryPolicy>());

            Assert.That(GetActiveRetryPolicy(client), Is.Not.SameAs(newPolicy), "The initial policy should be a unique instance");

            client.UpdateRetryPolicy(newPolicy);
            Assert.That(GetActiveRetryPolicy(client), Is.SameAs(newPolicy), "The updated policy should match");
        }
Exemple #2
0
        public void UpdateRetryPolicyUpdatesTheOperationTimeout()
        {
            var initialPolicy = new BasicRetryPolicy(new RetryOptions {
                TryTimeout = TimeSpan.FromSeconds(17)
            });
            TimeSpan initialTimeout = initialPolicy.CalculateTryTimeout(0);
            var      client         = new AmqpEventHubClient("my.eventhub.com", "somePath", Mock.Of <TokenCredential>(), new EventHubClientOptions(), initialPolicy);

            Assert.That(GetTimeout(client), Is.EqualTo(initialTimeout), "The initial timeout should match");

            var newPolicy = new BasicRetryPolicy(new RetryOptions {
                TryTimeout = TimeSpan.FromMilliseconds(50)
            });
            TimeSpan newTimeout = newPolicy.CalculateTryTimeout(0);

            client.UpdateRetryPolicy(newPolicy);
            Assert.That(GetTimeout(client), Is.EqualTo(newTimeout), "The updated timeout should match");
        }
Exemple #3
0
        public void UpdateRetryPolicyValidatesTheRetryPolicy()
        {
            var client = new AmqpEventHubClient("my.eventhub.com", "somePath", Mock.Of <TokenCredential>(), new EventHubClientOptions(), Mock.Of <EventHubRetryPolicy>());

            Assert.That(() => client.UpdateRetryPolicy(null), Throws.ArgumentNullException);
        }