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