< Summary

Class:Azure.ResourceManager.EventHubs.Models.AuthorizationRule
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\AuthorizationRule.cs
C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\AuthorizationRule.Serialization.cs
Covered lines:47
Uncovered lines:6
Coverable lines:53
Total lines:143
Line coverage:88.6% (47 of 53)
Covered branches:31
Total branches:34
Branch coverage:91.1% (31 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Rights()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-71.43%70%
DeserializeAuthorizationRule(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\AuthorizationRule.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9
 10namespace Azure.ResourceManager.EventHubs.Models
 11{
 12    /// <summary> Single item in a List or Get AuthorizationRule operation. </summary>
 13    public partial class AuthorizationRule : Resource
 14    {
 15        /// <summary> Initializes a new instance of AuthorizationRule. </summary>
 3216        public AuthorizationRule()
 17        {
 3218        }
 19
 20        /// <summary> Initializes a new instance of AuthorizationRule. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="rights"> The rights associated with the rule. </param>
 9225        internal AuthorizationRule(string id, string name, string type, IList<AccessRights> rights) : base(id, name, typ
 26        {
 9227            Rights = rights;
 9228        }
 29
 30        /// <summary> The rights associated with the rule. </summary>
 44831        public IList<AccessRights> Rights { get; set; }
 32    }
 33}

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\AuthorizationRule.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.EventHubs.Models
 13{
 14    public partial class AuthorizationRule : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 3218            writer.WriteStartObject();
 3219            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 3224            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 3229            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 3234            writer.WritePropertyName("properties");
 3235            writer.WriteStartObject();
 3236            if (Rights != null)
 37            {
 3238                writer.WritePropertyName("rights");
 3239                writer.WriteStartArray();
 16840                foreach (var item in Rights)
 41                {
 5242                    writer.WriteStringValue(item.ToString());
 43                }
 3244                writer.WriteEndArray();
 45            }
 3246            writer.WriteEndObject();
 3247            writer.WriteEndObject();
 3248        }
 49
 50        internal static AuthorizationRule DeserializeAuthorizationRule(JsonElement element)
 51        {
 9252            string id = default;
 9253            string name = default;
 9254            string type = default;
 9255            IList<AccessRights> rights = default;
 110456            foreach (var property in element.EnumerateObject())
 57            {
 46058                if (property.NameEquals("id"))
 59                {
 9260                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 9264                    id = property.Value.GetString();
 9265                    continue;
 66                }
 36867                if (property.NameEquals("name"))
 68                {
 9269                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 9273                    name = property.Value.GetString();
 9274                    continue;
 75                }
 27676                if (property.NameEquals("type"))
 77                {
 9278                    if (property.Value.ValueKind == JsonValueKind.Null)
 79                    {
 80                        continue;
 81                    }
 9282                    type = property.Value.GetString();
 9283                    continue;
 84                }
 18485                if (property.NameEquals("properties"))
 86                {
 36887                    foreach (var property0 in property.Value.EnumerateObject())
 88                    {
 9289                        if (property0.NameEquals("rights"))
 90                        {
 9291                            if (property0.Value.ValueKind == JsonValueKind.Null)
 92                            {
 93                                continue;
 94                            }
 9295                            List<AccessRights> array = new List<AccessRights>();
 52096                            foreach (var item in property0.Value.EnumerateArray())
 97                            {
 16898                                array.Add(new AccessRights(item.GetString()));
 99                            }
 92100                            rights = array;
 101                            continue;
 102                        }
 103                    }
 104                    continue;
 105                }
 106            }
 92107            return new AuthorizationRule(id, name, type, rights);
 108        }
 109    }
 110}