< Summary

Class:Azure.Messaging.ServiceBus.Management.AuthorizationRule
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Management\AuthorizationRule.cs
Covered lines:6
Uncovered lines:5
Coverable lines:11
Total lines:76
Line coverage:54.5% (6 of 11)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
get_CreatedTime()-0%100%
get_ModifiedTime()-0%100%
ParseFromXElement(...)-66.67%50%
GetHashCode()-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Data;
 7using System.Xml.Linq;
 8
 9namespace Azure.Messaging.ServiceBus.Management
 10{
 11    /// <summary>
 12    /// Specifies the authorization rule.
 13    /// </summary>
 14    public abstract class AuthorizationRule : IEquatable<AuthorizationRule>
 15    {
 7216        internal AuthorizationRule()
 17        {
 7218        }
 19
 20        internal abstract AuthorizationRule Clone();
 21
 22        /// <summary>Gets or sets the claim type.</summary>
 23        /// <value>The claim type.</value>
 24        public abstract string ClaimType { get; }
 25
 26        /// <summary>Gets or sets the claim value which is either ‘Send’, ‘Listen’, or ‘Manage’.</summary>
 27        /// <value>The claim value which is either ‘Send’, ‘Listen’, or ‘Manage’.</value>
 28        internal abstract string ClaimValue { get; }
 29
 30        /// <summary>Gets or sets the list of rights.</summary>
 31        /// <value>The list of rights.</value>
 32        [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Ju
 33        public abstract List<AccessRights> Rights { get; set; }
 34
 35        /// <summary>Gets or sets the authorization rule key name.</summary>
 36        /// <value>The authorization rule key name.</value>
 37        public abstract string KeyName { get; set; }
 38
 39        /// <summary>Gets or sets the date and time when the authorization rule was created.</summary>
 40        /// <value>The date and time when the authorization rule was created.</value>
 041        public DateTimeOffset CreatedTime { get; internal set; }
 42
 43        /// <summary>Gets or sets the date and time when the authorization rule was modified.</summary>
 44        /// <value>The date and time when the authorization rule was modified.</value>
 045        public DateTimeOffset ModifiedTime { get; internal set; }
 46
 47        /// <summary>Determines whether the specified object is equal to the current object.</summary>
 48        public abstract bool Equals(AuthorizationRule other);
 49
 50        internal static AuthorizationRule ParseFromXElement(XElement xElement)
 51        {
 4052            XAttribute attribute = xElement.Attribute(XName.Get("type", ManagementClientConstants.XmlSchemaInstanceNames
 4053            if (attribute == null)
 54            {
 055                return null;
 56            }
 57
 4058            switch (attribute.Value)
 59            {
 60                case "SharedAccessAuthorizationRule":
 4061                    return SharedAccessAuthorizationRule.ParseFromXElement(xElement);
 62                default:
 063                    return null;
 64            }
 65        }
 66
 67        internal abstract XElement Serialize();
 68
 69        /// <inheritdoc/>
 70        public abstract override bool Equals(object obj);
 71
 72        /// <inheritdoc/>
 73        public override int GetHashCode() =>
 074            base.GetHashCode();
 75    }
 76}