< Summary

Class:Azure.ResourceManager.Storage.Models.AzureEntityResource
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\AzureEntityResource.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\AzureEntityResource.Serialization.cs
Covered lines:6
Uncovered lines:36
Coverable lines:42
Total lines:120
Line coverage:14.2% (6 of 42)
Covered branches:0
Total branches:26
Branch coverage:0% (0 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeAzureEntityResource(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\AzureEntityResource.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> The resource model definition for a Azure Resource Manager resource with an etag. </summary>
 11    public partial class AzureEntityResource : Resource
 12    {
 13        /// <summary> Initializes a new instance of AzureEntityResource. </summary>
 11214        public AzureEntityResource()
 15        {
 11216        }
 17
 18        /// <summary> Initializes a new instance of AzureEntityResource. </summary>
 19        /// <param name="id"> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourc
 20        /// <param name="name"> The name of the resource. </param>
 21        /// <param name="type"> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/sto
 22        /// <param name="etag"> Resource Etag. </param>
 21223        internal AzureEntityResource(string id, string name, string type, string etag) : base(id, name, type)
 24        {
 21225            Etag = etag;
 21226        }
 27
 28        /// <summary> Resource Etag. </summary>
 16829        public string Etag { get; }
 30    }
 31}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\AzureEntityResource.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 AzureEntityResource : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Etag != null)
 19            {
 020                writer.WritePropertyName("etag");
 021                writer.WriteStringValue(Etag);
 22            }
 023            if (Id != null)
 24            {
 025                writer.WritePropertyName("id");
 026                writer.WriteStringValue(Id);
 27            }
 028            if (Name != null)
 29            {
 030                writer.WritePropertyName("name");
 031                writer.WriteStringValue(Name);
 32            }
 033            if (Type != null)
 34            {
 035                writer.WritePropertyName("type");
 036                writer.WriteStringValue(Type);
 37            }
 038            writer.WriteEndObject();
 039        }
 40
 41        internal static AzureEntityResource DeserializeAzureEntityResource(JsonElement element)
 42        {
 043            string etag = default;
 044            string id = default;
 045            string name = default;
 046            string type = default;
 047            foreach (var property in element.EnumerateObject())
 48            {
 049                if (property.NameEquals("etag"))
 50                {
 051                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 055                    etag = property.Value.GetString();
 056                    continue;
 57                }
 058                if (property.NameEquals("id"))
 59                {
 060                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 064                    id = property.Value.GetString();
 065                    continue;
 66                }
 067                if (property.NameEquals("name"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    name = property.Value.GetString();
 074                    continue;
 75                }
 076                if (property.NameEquals("type"))
 77                {
 078                    if (property.Value.ValueKind == JsonValueKind.Null)
 79                    {
 80                        continue;
 81                    }
 082                    type = property.Value.GetString();
 83                    continue;
 84                }
 85            }
 086            return new AzureEntityResource(id, name, type, etag);
 87        }
 88    }
 89}