public void CloneProducesACopy() { var options = new EventHubClientOptions { RetryOptions = new RetryOptions { MaximumRetries = 27 }, TransportType = TransportType.AmqpWebSockets, Proxy = Mock.Of <IWebProxy>() }; var clone = options.Clone(); Assert.That(clone, Is.Not.Null, "The clone should not be null."); Assert.That(clone.TransportType, Is.EqualTo(options.TransportType), "The connection type of the clone should match."); Assert.That(clone.Proxy, Is.EqualTo(options.Proxy), "The proxy of the clone should match."); Assert.That(clone.RetryOptions.IsEquivalentTo(options.RetryOptions), Is.True, "The retry options of the clone should be considered equal."); Assert.That(clone.RetryOptions, Is.Not.SameAs(options.RetryOptions), "The retry options of the clone should be a copy, not the same instance."); }
public void CloneProducesACopy() { var options = new EventHubClientOptions { Retry = new ExponentialRetry(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), 3), TransportType = TransportType.AmqpWebSockets, DefaultTimeout = TimeSpan.FromDays(1), Proxy = Mock.Of <IWebProxy>() }; var clone = options.Clone(); Assert.That(clone, Is.Not.Null, "The clone should not be null."); Assert.That(clone.TransportType, Is.EqualTo(options.TransportType), "The connection type of the clone should match."); Assert.That(clone.DefaultTimeout, Is.EqualTo(options.DefaultTimeout), "The default timeout of the clone should match."); Assert.That(clone.Proxy, Is.EqualTo(options.Proxy), "The proxy of the clone should match."); Assert.That(ExponentialRetry.HaveSameConfiguration((ExponentialRetry)clone.Retry, (ExponentialRetry)options.Retry), Is.True, "The retry of the clone should be considered equal."); Assert.That(clone.Retry, Is.Not.SameAs(options.Retry), "The retry of the clone should be a copy, not the same instance."); }