< Summary

Class:Azure.Messaging.ServiceBus.CreateMessageBatchOptions
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Sender\CreateMessageBatchOptions.cs
Covered lines:5
Uncovered lines:7
Coverable lines:12
Total lines:85
Line coverage:41.6% (5 of 12)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_MaxSizeInBytes()-100%100%
set_MaxSizeInBytes(...)-100%100%
Equals(...)-0%100%
GetHashCode()-0%100%
ToString()-0%100%
Clone()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Sender\CreateMessageBatchOptions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.ComponentModel;
 5using Azure.Core;
 6
 7namespace Azure.Messaging.ServiceBus
 8{
 9
 10    /// <summary>
 11    ///   The set of options that can be specified to influence the way in which an service bus message batch
 12    ///   behaves and is sent to the Queue/Topic.
 13    /// </summary>
 14    ///
 15    public class CreateMessageBatchOptions
 16    {
 17        /// <summary>The requested maximum size to allow for the batch, in bytes.</summary>
 18        private long? _maxSizeInBytes = null;
 19
 20        /// <summary>
 21        ///   The maximum size to allow for a single batch of messages, in bytes.
 22        /// </summary>
 23        ///
 24        /// <value>
 25        ///   The desired limit, in bytes, for the size of the associated service bus message batch.  If <c>null</c>,
 26        ///   the maximum size allowed by the active transport will be used.
 27        /// </value>
 28        ///
 29        public long? MaxSizeInBytes
 30        {
 5431            get => _maxSizeInBytes;
 32
 33            set
 34            {
 2835                if (value.HasValue)
 36                {
 2637                    Argument.AssertAtLeast(value.Value, ServiceBusSender.MinimumBatchSizeLimit, nameof(MaxSizeInBytes));
 38                }
 39
 2840                _maxSizeInBytes = value;
 2841            }
 42        }
 43
 44        /// <summary>
 45        ///   Determines whether the specified <see cref="System.Object" /> is equal to this instance.
 46        /// </summary>
 47        ///
 48        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
 49        ///
 50        /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>
 51        ///
 52        [EditorBrowsable(EditorBrowsableState.Never)]
 053        public override bool Equals(object obj) => base.Equals(obj);
 54
 55        /// <summary>
 56        ///   Returns a hash code for this instance.
 57        /// </summary>
 58        ///
 59        /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a ha
 60        ///
 61        [EditorBrowsable(EditorBrowsableState.Never)]
 062        public override int GetHashCode() => base.GetHashCode();
 63
 64        /// <summary>
 65        ///   Converts the instance to string representation.
 66        /// </summary>
 67        ///
 68        /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
 69        ///
 70        [EditorBrowsable(EditorBrowsableState.Never)]
 071        public override string ToString() => base.ToString();
 72
 73        /// <summary>
 74        ///   Creates a new copy of the current <see cref="CreateMessageBatchOptions" />, cloning its attributes into a 
 75        /// </summary>
 76        ///
 77        /// <returns>A new copy of <see cref="CreateMessageBatchOptions" />.</returns>
 78        ///
 79        internal CreateMessageBatchOptions Clone() =>
 080            new CreateMessageBatchOptions
 081            {
 082                _maxSizeInBytes = MaxSizeInBytes
 083            };
 84    }
 85}