< Summary

Class:Azure.ResourceManager.Storage.Models.Resource
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Resource.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Resource.Serialization.cs
Covered lines:10
Uncovered lines:28
Coverable lines:38
Total lines:110
Line coverage:26.3% (10 of 38)
Covered branches:0
Total branches:20
Branch coverage:0% (0 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-100%100%
get_Type()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeResource(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Resource.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. </summary>
 11    public partial class Resource
 12    {
 13        /// <summary> Initializes a new instance of Resource. </summary>
 13614        public Resource()
 15        {
 13616        }
 17
 18        /// <summary> Initializes a new instance of Resource. </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
 119222        internal Resource(string id, string name, string type)
 23        {
 119224            Id = id;
 119225            Name = name;
 119226            Type = type;
 119227        }
 28
 29        /// <summary> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/
 44030        public string Id { get; }
 31        /// <summary> The name of the resource. </summary>
 82432        public string Name { get; }
 33        /// <summary> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccoun
 26834        public string Type { get; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Resource.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 Resource : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Id != null)
 19            {
 020                writer.WritePropertyName("id");
 021                writer.WriteStringValue(Id);
 22            }
 023            if (Name != null)
 24            {
 025                writer.WritePropertyName("name");
 026                writer.WriteStringValue(Name);
 27            }
 028            if (Type != null)
 29            {
 030                writer.WritePropertyName("type");
 031                writer.WriteStringValue(Type);
 32            }
 033            writer.WriteEndObject();
 034        }
 35
 36        internal static Resource DeserializeResource(JsonElement element)
 37        {
 038            string id = default;
 039            string name = default;
 040            string type = default;
 041            foreach (var property in element.EnumerateObject())
 42            {
 043                if (property.NameEquals("id"))
 44                {
 045                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 049                    id = property.Value.GetString();
 050                    continue;
 51                }
 052                if (property.NameEquals("name"))
 53                {
 054                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 058                    name = property.Value.GetString();
 059                    continue;
 60                }
 061                if (property.NameEquals("type"))
 62                {
 063                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 067                    type = property.Value.GetString();
 68                    continue;
 69                }
 70            }
 071            return new Resource(id, name, type);
 72        }
 73    }
 74}