< Summary

Class:Azure.ResourceManager.Resources.Models.IdentityAutoGenerated
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\IdentityAutoGenerated.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\IdentityAutoGenerated.Serialization.cs
Covered lines:34
Uncovered lines:4
Coverable lines:38
Total lines:110
Line coverage:89.4% (34 of 38)
Covered branches:18
Total branches:20
Branch coverage:90% (18 of 20)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\IdentityAutoGenerated.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> Identity for the resource. </summary>
 11    public partial class IdentityAutoGenerated
 12    {
 13        /// <summary> Initializes a new instance of IdentityAutoGenerated. </summary>
 414        public IdentityAutoGenerated()
 15        {
 416        }
 17
 18        /// <summary> Initializes a new instance of IdentityAutoGenerated. </summary>
 19        /// <param name="principalId"> The principal ID of the resource identity. </param>
 20        /// <param name="tenantId"> The tenant ID of the resource identity. </param>
 21        /// <param name="type"> The identity type. This is the only required field when adding a system assigned identit
 2422        internal IdentityAutoGenerated(string principalId, string tenantId, ResourceIdentityType? type)
 23        {
 2424            PrincipalId = principalId;
 2425            TenantId = tenantId;
 2426            Type = type;
 2427        }
 28
 29        /// <summary> The principal ID of the resource identity. </summary>
 1630        public string PrincipalId { get; }
 31        /// <summary> The tenant ID of the resource identity. </summary>
 1632        public string TenantId { get; }
 33        /// <summary> The identity type. This is the only required field when adding a system assigned identity to a res
 6034        public ResourceIdentityType? Type { get; set; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\IdentityAutoGenerated.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 IdentityAutoGenerated : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 817            writer.WriteStartObject();
 818            if (PrincipalId != null)
 19            {
 020                writer.WritePropertyName("principalId");
 021                writer.WriteStringValue(PrincipalId);
 22            }
 823            if (TenantId != null)
 24            {
 025                writer.WritePropertyName("tenantId");
 026                writer.WriteStringValue(TenantId);
 27            }
 828            if (Type != null)
 29            {
 830                writer.WritePropertyName("type");
 831                writer.WriteStringValue(Type.Value.ToSerialString());
 32            }
 833            writer.WriteEndObject();
 834        }
 35
 36        internal static IdentityAutoGenerated DeserializeIdentityAutoGenerated(JsonElement element)
 37        {
 2438            string principalId = default;
 2439            string tenantId = default;
 2440            ResourceIdentityType? type = default;
 19241            foreach (var property in element.EnumerateObject())
 42            {
 7243                if (property.NameEquals("principalId"))
 44                {
 2445                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 2449                    principalId = property.Value.GetString();
 2450                    continue;
 51                }
 4852                if (property.NameEquals("tenantId"))
 53                {
 2454                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 2458                    tenantId = property.Value.GetString();
 2459                    continue;
 60                }
 2461                if (property.NameEquals("type"))
 62                {
 2463                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 2467                    type = property.Value.GetString().ToResourceIdentityType();
 68                    continue;
 69                }
 70            }
 2471            return new IdentityAutoGenerated(principalId, tenantId, type);
 72        }
 73    }
 74}