< Summary

Class:Azure.ResourceManager.Resources.Models.AzureResourceBase
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzureResourceBase.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzureResourceBase.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%
DeserializeAzureResourceBase(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzureResourceBase.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> Common properties for all Azure resources. </summary>
 11    public partial class AzureResourceBase
 12    {
 13        /// <summary> Initializes a new instance of AzureResourceBase. </summary>
 1214        public AzureResourceBase()
 15        {
 1216        }
 17
 18        /// <summary> Initializes a new instance of AzureResourceBase. </summary>
 19        /// <param name="id"> String Id used to locate any resource on Azure. </param>
 20        /// <param name="name"> Name of this resource. </param>
 21        /// <param name="type"> Type of this resource. </param>
 7822        internal AzureResourceBase(string id, string name, string type)
 23        {
 7824            Id = id;
 7825            Name = name;
 7826            Type = type;
 7827        }
 28
 29        /// <summary> String Id used to locate any resource on Azure. </summary>
 2830        public string Id { get; }
 31        /// <summary> Name of this resource. </summary>
 5232        public string Name { get; }
 33        /// <summary> Type of this resource. </summary>
 2434        public string Type { get; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzureResourceBase.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 AzureResourceBase : 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 AzureResourceBase DeserializeAzureResourceBase(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 AzureResourceBase(id, name, type);
 72        }
 73    }
 74}