< Summary

Class:Azure.ResourceManager.Storage.Models.Identity
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Identity.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Identity.Serialization.cs
Covered lines:20
Uncovered lines:17
Coverable lines:37
Total lines:104
Line coverage:54% (20 of 37)
Covered branches:12
Total branches:16
Branch coverage:75% (12 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_PrincipalId()-0%100%
get_TenantId()-0%100%
get_Type()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeIdentity(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Identity.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.Storage.Models
 9{
 10    /// <summary> Identity for the resource. </summary>
 11    public partial class Identity
 12    {
 13        /// <summary> Initializes a new instance of Identity. </summary>
 014        public Identity()
 15        {
 016            Type = "SystemAssigned";
 017        }
 18
 19        /// <summary> Initializes a new instance of Identity. </summary>
 20        /// <param name="principalId"> The principal ID of resource identity. </param>
 21        /// <param name="tenantId"> The tenant ID of resource. </param>
 22        /// <param name="type"> The identity type. </param>
 2423        internal Identity(string principalId, string tenantId, string type)
 24        {
 2425            PrincipalId = principalId;
 2426            TenantId = tenantId;
 2427            Type = type;
 2428        }
 29
 30        /// <summary> The principal ID of resource identity. </summary>
 031        public string PrincipalId { get; }
 32        /// <summary> The tenant ID of resource. </summary>
 033        public string TenantId { get; }
 34        /// <summary> The identity type. </summary>
 035        public string Type { get; set; }
 36    }
 37}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Identity.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.Storage.Models
 12{
 13    public partial class Identity : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (PrincipalId != null)
 19            {
 020                writer.WritePropertyName("principalId");
 021                writer.WriteStringValue(PrincipalId);
 22            }
 023            if (TenantId != null)
 24            {
 025                writer.WritePropertyName("tenantId");
 026                writer.WriteStringValue(TenantId);
 27            }
 028            writer.WritePropertyName("type");
 029            writer.WriteStringValue(Type);
 030            writer.WriteEndObject();
 031        }
 32
 33        internal static Identity DeserializeIdentity(JsonElement element)
 34        {
 2435            string principalId = default;
 2436            string tenantId = default;
 2437            string type = default;
 19238            foreach (var property in element.EnumerateObject())
 39            {
 7240                if (property.NameEquals("principalId"))
 41                {
 2442                    if (property.Value.ValueKind == JsonValueKind.Null)
 43                    {
 44                        continue;
 45                    }
 2446                    principalId = property.Value.GetString();
 2447                    continue;
 48                }
 4849                if (property.NameEquals("tenantId"))
 50                {
 2451                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 2455                    tenantId = property.Value.GetString();
 2456                    continue;
 57                }
 2458                if (property.NameEquals("type"))
 59                {
 2460                    type = property.Value.GetString();
 61                    continue;
 62                }
 63            }
 2464            return new Identity(principalId, tenantId, type);
 65        }
 66    }
 67}