< Summary

Class:Azure.Messaging.ServiceBus.Management.NamespaceType
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Management\NamespaceType.cs
Covered lines:5
Uncovered lines:6
Coverable lines:11
Total lines:75
Line coverage:45.4% (5 of 11)
Covered branches:1
Total branches:6
Branch coverage:16.6% (1 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
get_Messaging()-100%100%
get_Mixed()-0%100%
op_Equality(...)-0%100%
op_Inequality(...)-0%100%
op_Implicit(...)-100%100%
Equals(...)-0%0%
Equals(...)-100%100%
GetHashCode()-0%0%
ToString()-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.ComponentModel;
 6
 7namespace Azure.Messaging.ServiceBus.Management
 8{
 9    /// <summary>
 10    /// Specifies the type of entities the namespace can contain.
 11    /// </summary>
 12    internal readonly struct NamespaceType : IEquatable<NamespaceType>
 13    {
 14        internal const string MessagingValue = "Messaging";
 15        internal const string MixedValue = "Mixed";
 16
 17        private readonly string _value;
 18
 19        /// <summary>
 20        /// Initializes a new instance of the <see cref="NamespaceType"/> structure.
 21        /// </summary>
 22        /// <param name="value">The string value of the instance.</param>
 23        public NamespaceType(string value)
 24        {
 825            _value = value ?? throw new ArgumentNullException(nameof(value));
 826        }
 27
 28        /// <summary>
 29        /// Namespace contains service bus entities (queues, topics).
 30        /// </summary>
 631        public static NamespaceType Messaging { get; } = new NamespaceType(MessagingValue);
 32
 33        /// <summary>
 34        /// Supported only for backward compatibility.
 35        /// Namespace can contain mixture of messaging entities and notification hubs.
 36        /// </summary>
 037        public static NamespaceType Mixed { get; } = new NamespaceType(MixedValue);
 38
 39        /// <summary>
 40        /// Determines if two <see cref="NamespaceType"/> values are the same.
 41        /// </summary>
 42        /// <param name="left">The first <see cref="NamespaceType"/> to compare.</param>
 43        /// <param name="right">The second <see cref="NamespaceType"/> to compare.</param>
 44        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur
 045        public static bool operator ==(NamespaceType left, NamespaceType right) => left.Equals(right);
 46
 47        /// <summary>
 48        /// Determines if two <see cref="NamespaceType"/> values are different.
 49        /// </summary>
 50        /// <param name="left">The first <see cref="NamespaceType"/> to compare.</param>
 51        /// <param name="right">The second <see cref="NamespaceType"/> to compare.</param>
 52        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu
 053        public static bool operator !=(NamespaceType left, NamespaceType right) => !left.Equals(right);
 54
 55        /// <summary>
 56        /// Converts a string to a <see cref="NamespaceType"/>.
 57        /// </summary>
 58        /// <param name="value">The string value to convert.</param>
 459        public static implicit operator NamespaceType(string value) => new NamespaceType(value);
 60
 61        /// <inheritdoc/>
 62        [EditorBrowsable(EditorBrowsableState.Never)]
 063        public override bool Equals(object obj) => obj is NamespaceType other && Equals(other);
 64
 65        /// <inheritdoc/>
 466        public bool Equals(NamespaceType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
 67
 68        /// <inheritdoc/>
 69        [EditorBrowsable(EditorBrowsableState.Never)]
 070        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
 71
 72        /// <inheritdoc/>
 073        public override string ToString() => _value;
 74    }
 75}