public void UpdateRetryPolicyUpdatesTheRetryPolicy() { var newPolicy = new BasicRetryPolicy(new RetryOptions { Delay = TimeSpan.FromMilliseconds(50) }); var consumer = new AmqpEventHubConsumer("aHub", "$DEFAULT", "0", EventPosition.Earliest, new EventHubConsumerOptions(), Mock.Of <AmqpConnectionScope>(), Mock.Of <AmqpMessageConverter>(), Mock.Of <EventHubRetryPolicy>(), null); Assert.That(GetActiveRetryPolicy(consumer), Is.Not.SameAs(newPolicy), "The initial policy should be a unique instance"); consumer.UpdateRetryPolicy(newPolicy); Assert.That(GetActiveRetryPolicy(consumer), Is.SameAs(newPolicy), "The updated policy should match"); }
public void UpdateRetryPolicyUpdatesTheOperationTimeout() { var initialPolicy = new BasicRetryPolicy(new RetryOptions { TryTimeout = TimeSpan.FromSeconds(17) }); var initialTimeout = initialPolicy.CalculateTryTimeout(0); var consumer = new AmqpEventHubConsumer("aHub", "$DEFAULT", "0", EventPosition.Earliest, new EventHubConsumerOptions(), Mock.Of <AmqpConnectionScope>(), Mock.Of <AmqpMessageConverter>(), initialPolicy, null); Assert.That(GetTimeout(consumer), Is.EqualTo(initialTimeout), "The initial timeout should match"); var newPolicy = new BasicRetryPolicy(new RetryOptions { TryTimeout = TimeSpan.FromMilliseconds(50) }); TimeSpan newTimeout = newPolicy.CalculateTryTimeout(0); consumer.UpdateRetryPolicy(newPolicy); Assert.That(GetTimeout(consumer), Is.EqualTo(newTimeout), "The updated timeout should match"); }
public void UpdateRetryPolicyValidatesTheRetryPolicy() { var consumer = new AmqpEventHubConsumer("aHub", "$DEFAULT", "0", EventPosition.Earliest, new EventHubConsumerOptions(), Mock.Of <AmqpConnectionScope>(), Mock.Of <AmqpMessageConverter>(), Mock.Of <EventHubRetryPolicy>(), null); Assert.That(() => consumer.UpdateRetryPolicy(null), Throws.ArgumentNullException); }