/// <summary>
 ///   Creates a new copy of the current <see cref="QueueReceiverClientOptions" />, cloning its attributes into a new instance.
 /// </summary>
 ///
 /// <returns>A new copy of <see cref="QueueReceiverClientOptions" />.</returns>
 ///
 internal QueueReceiverClientOptions Clone() =>
 new QueueReceiverClientOptions
 {
     _connectionOptions = ConnectionOptions.Clone(),
     _retryOptions      = RetryOptions.Clone(),
     ReceiveMode        = ReceiveMode
 };
        public void CloneProducesACopy()
        {
            var options = new RetryOptions
            {
                Mode           = RetryMode.Fixed,
                MaximumRetries = 65,
                Delay          = TimeSpan.FromSeconds(1),
                MaximumDelay   = TimeSpan.FromSeconds(2),
                TryTimeout     = TimeSpan.FromSeconds(3)
            };

            var clone = options.Clone();

            Assert.That(clone, Is.Not.Null, "The clone should not be null.");

            Assert.That(clone.Mode, Is.EqualTo(options.Mode), "The mode of the clone should match.");
            Assert.That(clone.MaximumRetries, Is.EqualTo(options.MaximumRetries), "The maximum retry limit of the clone should match.");
            Assert.That(clone.Delay, Is.EqualTo(options.Delay), "The delay of the clone should match.");
            Assert.That(clone.MaximumDelay, Is.EqualTo(options.MaximumDelay), "The maximum delay of the clone should match.");
            Assert.That(clone.TryTimeout, Is.EqualTo(options.TryTimeout), "The per-try of the clone should match.");
        }
Пример #3
0
 /// <summary>
 ///   Creates a new copy of the current <see cref="SessionReceiverClientOptions" />, cloning its attributes into a new instance.
 /// </summary>
 ///
 /// <returns>A new copy of <see cref="SessionReceiverClientOptions" />.</returns>
 ///
 internal SessionReceiverClientOptions Clone() =>
 new SessionReceiverClientOptions
 {
     _connectionOptions = ConnectionOptions.Clone(),
     _retryOptions      = RetryOptions.Clone()
 };
Пример #4
0
 /// <summary>
 ///   Creates a new copy of the current <see cref="SubscriptionClientOptions" />, cloning its attributes into a new instance.
 /// </summary>
 ///
 /// <returns>A new copy of <see cref="SubscriptionClientOptions" />.</returns>
 ///
 internal SubscriptionClientOptions Clone() =>
 new SubscriptionClientOptions
 {
     _connectionOptions = ConnectionOptions.Clone(),
     _retryOptions      = RetryOptions.Clone()
 };