< Summary

Class:Azure.ResourceManager.Resources.Models.UserAssignedIdentity
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\UserAssignedIdentity.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\UserAssignedIdentity.Serialization.cs
Covered lines:24
Uncovered lines:4
Coverable lines:28
Total lines:91
Line coverage:85.7% (24 of 28)
Covered branches:12
Total branches:14
Branch coverage:85.7% (12 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_PrincipalId()-100%100%
get_ClientId()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-55.56%50%
DeserializeUserAssignedIdentity(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\UserAssignedIdentity.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
 8namespace Azure.ResourceManager.Resources.Models
 9{
 10    /// <summary> User-assigned managed identity. </summary>
 11    public partial class UserAssignedIdentity
 12    {
 13        /// <summary> Initializes a new instance of UserAssignedIdentity. </summary>
 1214        public UserAssignedIdentity()
 15        {
 1216        }
 17
 18        /// <summary> Initializes a new instance of UserAssignedIdentity. </summary>
 19        /// <param name="principalId"> Azure Active Directory principal ID associated with this identity. </param>
 20        /// <param name="clientId"> Client App Id associated with this identity. </param>
 7421        internal UserAssignedIdentity(string principalId, string clientId)
 22        {
 7423            PrincipalId = principalId;
 7424            ClientId = clientId;
 7425        }
 26
 27        /// <summary> Azure Active Directory principal ID associated with this identity. </summary>
 10228        public string PrincipalId { get; set; }
 29        /// <summary> Client App Id associated with this identity. </summary>
 10230        public string ClientId { get; set; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\UserAssignedIdentity.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Resources.Models
 12{
 13    public partial class UserAssignedIdentity : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 2417            writer.WriteStartObject();
 2418            if (PrincipalId != null)
 19            {
 020                writer.WritePropertyName("principalId");
 021                writer.WriteStringValue(PrincipalId);
 22            }
 2423            if (ClientId != null)
 24            {
 025                writer.WritePropertyName("clientId");
 026                writer.WriteStringValue(ClientId);
 27            }
 2428            writer.WriteEndObject();
 2429        }
 30
 31        internal static UserAssignedIdentity DeserializeUserAssignedIdentity(JsonElement element)
 32        {
 7433            string principalId = default;
 7434            string clientId = default;
 44435            foreach (var property in element.EnumerateObject())
 36            {
 14837                if (property.NameEquals("principalId"))
 38                {
 7439                    if (property.Value.ValueKind == JsonValueKind.Null)
 40                    {
 41                        continue;
 42                    }
 7443                    principalId = property.Value.GetString();
 7444                    continue;
 45                }
 7446                if (property.NameEquals("clientId"))
 47                {
 7448                    if (property.Value.ValueKind == JsonValueKind.Null)
 49                    {
 50                        continue;
 51                    }
 7452                    clientId = property.Value.GetString();
 53                    continue;
 54                }
 55            }
 7456            return new UserAssignedIdentity(principalId, clientId);
 57        }
 58    }
 59}