< Summary

Class:Azure.Security.KeyVault.Administration.Models.RoleDefinition
Assembly:Azure.Security.KeyVault.Administration
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Administration\src\Generated\Models\RoleDefinition.cs
C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Administration\src\Generated\Models\RoleDefinition.Serialization.cs
Covered lines:59
Uncovered lines:4
Coverable lines:63
Total lines:150
Line coverage:93.6% (59 of 63)
Covered branches:26
Total branches:26
Branch coverage:100% (26 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-100%100%
get_Type()-100%100%
get_RoleName()-100%100%
get_Description()-100%100%
get_RoleType()-100%100%
get_Permissions()-100%100%
get_AssignableScopes()-100%100%
DeserializeRoleDefinition(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Administration\src\Generated\Models\RoleDefinition.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 Azure.Core;
 10
 11namespace Azure.Security.KeyVault.Administration.Models
 12{
 13    /// <summary> Role definition. </summary>
 14    public partial class RoleDefinition
 15    {
 16        /// <summary> Initializes a new instance of RoleDefinition. </summary>
 017        internal RoleDefinition()
 18        {
 019            Permissions = new ChangeTrackingList<KeyVaultPermission>();
 020            AssignableScopes = new ChangeTrackingList<string>();
 021        }
 22
 23        /// <summary> Initializes a new instance of RoleDefinition. </summary>
 24        /// <param name="id"> The role definition ID. </param>
 25        /// <param name="name"> The role definition name. </param>
 26        /// <param name="type"> The role definition type. </param>
 27        /// <param name="roleName"> The role name. </param>
 28        /// <param name="description"> The role definition description. </param>
 29        /// <param name="roleType"> The role type. </param>
 30        /// <param name="permissions"> Role definition permissions. </param>
 31        /// <param name="assignableScopes"> Role definition assignable scopes. </param>
 20432        internal RoleDefinition(string id, string name, string type, string roleName, string description, string roleTyp
 33        {
 20434            Id = id;
 20435            Name = name;
 20436            Type = type;
 20437            RoleName = roleName;
 20438            Description = description;
 20439            RoleType = roleType;
 20440            Permissions = permissions;
 20441            AssignableScopes = assignableScopes;
 20442        }
 43
 44        /// <summary> The role definition ID. </summary>
 3845        public string Id { get; }
 46        /// <summary> The role definition name. </summary>
 447        public string Name { get; }
 48        /// <summary> The role definition type. </summary>
 449        public string Type { get; }
 50        /// <summary> The role name. </summary>
 8251        public string RoleName { get; }
 52        /// <summary> The role definition description. </summary>
 1653        public string Description { get; }
 54        /// <summary> The role type. </summary>
 455        public string RoleType { get; }
 56        /// <summary> Role definition permissions. </summary>
 457        public IReadOnlyList<KeyVaultPermission> Permissions { get; }
 58        /// <summary> Role definition assignable scopes. </summary>
 459        public IReadOnlyList<string> AssignableScopes { get; }
 60    }
 61}

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Administration\src\Generated\Models\RoleDefinition.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.Security.KeyVault.Administration.Models
 13{
 14    public partial class RoleDefinition
 15    {
 16        internal static RoleDefinition DeserializeRoleDefinition(JsonElement element)
 17        {
 20418            Optional<string> id = default;
 20419            Optional<string> name = default;
 20420            Optional<string> type = default;
 20421            Optional<string> roleName = default;
 20422            Optional<string> description = default;
 20423            Optional<string> type0 = default;
 20424            Optional<IReadOnlyList<KeyVaultPermission>> permissions = default;
 20425            Optional<IReadOnlyList<string>> assignableScopes = default;
 204026            foreach (var property in element.EnumerateObject())
 27            {
 81628                if (property.NameEquals("id"))
 29                {
 20430                    id = property.Value.GetString();
 20431                    continue;
 32                }
 61233                if (property.NameEquals("name"))
 34                {
 20435                    name = property.Value.GetString();
 20436                    continue;
 37                }
 40838                if (property.NameEquals("type"))
 39                {
 20440                    type = property.Value.GetString();
 20441                    continue;
 42                }
 20443                if (property.NameEquals("properties"))
 44                {
 244845                    foreach (var property0 in property.Value.EnumerateObject())
 46                    {
 102047                        if (property0.NameEquals("roleName"))
 48                        {
 20449                            roleName = property0.Value.GetString();
 20450                            continue;
 51                        }
 81652                        if (property0.NameEquals("description"))
 53                        {
 20454                            description = property0.Value.GetString();
 20455                            continue;
 56                        }
 61257                        if (property0.NameEquals("type"))
 58                        {
 20459                            type0 = property0.Value.GetString();
 20460                            continue;
 61                        }
 40862                        if (property0.NameEquals("permissions"))
 63                        {
 20464                            List<KeyVaultPermission> array = new List<KeyVaultPermission>();
 81665                            foreach (var item in property0.Value.EnumerateArray())
 66                            {
 20467                                array.Add(KeyVaultPermission.DeserializeKeyVaultPermission(item));
 68                            }
 20469                            permissions = array;
 20470                            continue;
 71                        }
 20472                        if (property0.NameEquals("assignableScopes"))
 73                        {
 20474                            List<string> array = new List<string>();
 81675                            foreach (var item in property0.Value.EnumerateArray())
 76                            {
 20477                                array.Add(item.GetString());
 78                            }
 20479                            assignableScopes = array;
 80                            continue;
 81                        }
 82                    }
 83                    continue;
 84                }
 85            }
 20486            return new RoleDefinition(id.Value, name.Value, type.Value, roleName.Value, description.Value, type0.Value, 
 87        }
 88    }
 89}