< Summary

Class:Azure.ResourceManager.Resources.Models.ManagedServiceIdentity
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagedServiceIdentity.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagedServiceIdentity.Serialization.cs
Covered lines:37
Uncovered lines:1
Coverable lines:38
Total lines:113
Line coverage:97.3% (37 of 38)
Covered branches:19
Total branches:20
Branch coverage:95% (19 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Type()-100%100%
get_UserAssignedIdentities()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeManagedServiceIdentity(...)-93.75%92.86%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagedServiceIdentity.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.Resources.Models
 11{
 12    /// <summary> Managed identity generic object. </summary>
 13    public partial class ManagedServiceIdentity
 14    {
 15        /// <summary> Initializes a new instance of ManagedServiceIdentity. </summary>
 1216        public ManagedServiceIdentity()
 17        {
 1218            Type = "UserAssigned";
 1219        }
 20
 21        /// <summary> Initializes a new instance of ManagedServiceIdentity. </summary>
 22        /// <param name="type"> Type of the managed identity. </param>
 23        /// <param name="userAssignedIdentities"> The list of user-assigned managed identities associated with the resou
 7424        internal ManagedServiceIdentity(string type, IDictionary<string, UserAssignedIdentity> userAssignedIdentities)
 25        {
 7426            Type = type;
 7427            UserAssignedIdentities = userAssignedIdentities;
 7428        }
 29
 30        /// <summary> Type of the managed identity. </summary>
 15431        public string Type { get; set; }
 32        /// <summary> The list of user-assigned managed identities associated with the resource. Key is the Azure resour
 15433        public IDictionary<string, UserAssignedIdentity> UserAssignedIdentities { get; set; }
 34    }
 35}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagedServiceIdentity.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.Resources.Models
 13{
 14    public partial class ManagedServiceIdentity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 2418            writer.WriteStartObject();
 2419            if (Type != null)
 20            {
 2421                writer.WritePropertyName("type");
 2422                writer.WriteStringValue(Type);
 23            }
 2424            if (UserAssignedIdentities != null)
 25            {
 2426                writer.WritePropertyName("userAssignedIdentities");
 2427                writer.WriteStartObject();
 9628                foreach (var item in UserAssignedIdentities)
 29                {
 2430                    writer.WritePropertyName(item.Key);
 2431                    writer.WriteObjectValue(item.Value);
 32                }
 2433                writer.WriteEndObject();
 34            }
 2435            writer.WriteEndObject();
 2436        }
 37
 38        internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element)
 39        {
 7440            string type = default;
 7441            IDictionary<string, UserAssignedIdentity> userAssignedIdentities = default;
 59242            foreach (var property in element.EnumerateObject())
 43            {
 22244                if (property.NameEquals("type"))
 45                {
 7446                    if (property.Value.ValueKind == JsonValueKind.Null)
 47                    {
 48                        continue;
 49                    }
 7450                    type = property.Value.GetString();
 7451                    continue;
 52                }
 14853                if (property.NameEquals("userAssignedIdentities"))
 54                {
 7455                    if (property.Value.ValueKind == JsonValueKind.Null)
 56                    {
 57                        continue;
 58                    }
 7459                    Dictionary<string, UserAssignedIdentity> dictionary = new Dictionary<string, UserAssignedIdentity>()
 29660                    foreach (var property0 in property.Value.EnumerateObject())
 61                    {
 7462                        if (property0.Value.ValueKind == JsonValueKind.Null)
 63                        {
 064                            dictionary.Add(property0.Name, null);
 65                        }
 66                        else
 67                        {
 7468                            dictionary.Add(property0.Name, UserAssignedIdentity.DeserializeUserAssignedIdentity(property
 69                        }
 70                    }
 7471                    userAssignedIdentities = dictionary;
 72                    continue;
 73                }
 74            }
 7475            return new ManagedServiceIdentity(type, userAssignedIdentities);
 76        }
 77    }
 78}