< Summary

Class:Azure.ResourceManager.Resources.Models.GenericResource
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResource.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResource.Serialization.cs
Covered lines:103
Uncovered lines:14
Coverable lines:117
Total lines:268
Line coverage:88% (103 of 117)
Covered branches:66
Total branches:74
Branch coverage:89.1% (66 of 74)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Plan()-100%100%
get_Properties()-100%100%
get_Kind()-100%100%
get_ManagedBy()-100%100%
get_Sku()-100%100%
get_Identity()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-75%79.17%
DeserializeGenericResource(...)-93.44%94%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResource.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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> Resource information. </summary>
 13    public partial class GenericResource : Resource
 14    {
 15        /// <summary> Initializes a new instance of GenericResource. </summary>
 6016        public GenericResource()
 17        {
 6018        }
 19
 20        /// <summary> Initializes a new instance of GenericResource. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 26        /// <param name="plan"> The plan of the resource. </param>
 27        /// <param name="properties"> The resource properties. </param>
 28        /// <param name="kind"> The kind of the resource. </param>
 29        /// <param name="managedBy"> ID of the resource that manages this resource. </param>
 30        /// <param name="sku"> The SKU of the resource. </param>
 31        /// <param name="identity"> The identity of the resource. </param>
 30232        internal GenericResource(string id, string name, string type, string location, IDictionary<string, string> tags,
 33        {
 30234            Plan = plan;
 30235            Properties = properties;
 30236            Kind = kind;
 30237            ManagedBy = managedBy;
 30238            Sku = sku;
 30239            Identity = identity;
 30240        }
 41
 42        /// <summary> The plan of the resource. </summary>
 44243        public Plan Plan { get; set; }
 44        /// <summary> The resource properties. </summary>
 63845        public object Properties { get; set; }
 46        /// <summary> The kind of the resource. </summary>
 41447        public string Kind { get; set; }
 48        /// <summary> ID of the resource that manages this resource. </summary>
 41449        public string ManagedBy { get; set; }
 50        /// <summary> The SKU of the resource. </summary>
 56251        public Sku Sku { get; set; }
 52        /// <summary> The identity of the resource. </summary>
 43453        public Identity Identity { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResource.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Resources.Models
 13{
 14    public partial class GenericResource : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 11218            writer.WriteStartObject();
 11219            if (Plan != null)
 20            {
 821                writer.WritePropertyName("plan");
 822                writer.WriteObjectValue(Plan);
 23            }
 11224            if (Properties != null)
 25            {
 11226                writer.WritePropertyName("properties");
 11227                writer.WriteObjectValue(Properties);
 28            }
 11229            if (Kind != null)
 30            {
 031                writer.WritePropertyName("kind");
 032                writer.WriteStringValue(Kind);
 33            }
 11234            if (ManagedBy != null)
 35            {
 036                writer.WritePropertyName("managedBy");
 037                writer.WriteStringValue(ManagedBy);
 38            }
 11239            if (Sku != null)
 40            {
 7241                writer.WritePropertyName("sku");
 7242                writer.WriteObjectValue(Sku);
 43            }
 11244            if (Identity != null)
 45            {
 846                writer.WritePropertyName("identity");
 847                writer.WriteObjectValue(Identity);
 48            }
 11249            if (Id != null)
 50            {
 051                writer.WritePropertyName("id");
 052                writer.WriteStringValue(Id);
 53            }
 11254            if (Name != null)
 55            {
 056                writer.WritePropertyName("name");
 057                writer.WriteStringValue(Name);
 58            }
 11259            if (Type != null)
 60            {
 061                writer.WritePropertyName("type");
 062                writer.WriteStringValue(Type);
 63            }
 11264            if (Location != null)
 65            {
 11266                writer.WritePropertyName("location");
 11267                writer.WriteStringValue(Location);
 68            }
 11269            if (Tags != null)
 70            {
 4871                writer.WritePropertyName("tags");
 4872                writer.WriteStartObject();
 24073                foreach (var item in Tags)
 74                {
 7275                    writer.WritePropertyName(item.Key);
 7276                    writer.WriteStringValue(item.Value);
 77                }
 4878                writer.WriteEndObject();
 79            }
 11280            writer.WriteEndObject();
 11281        }
 82
 83        internal static GenericResource DeserializeGenericResource(JsonElement element)
 84        {
 5285            Plan plan = default;
 5286            object properties = default;
 5287            string kind = default;
 5288            string managedBy = default;
 5289            Sku sku = default;
 5290            Identity identity = default;
 5291            string id = default;
 5292            string name = default;
 5293            string type = default;
 5294            string location = default;
 5295            IDictionary<string, string> tags = default;
 66496            foreach (var property in element.EnumerateObject())
 97            {
 28098                if (property.NameEquals("plan"))
 99                {
 8100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 8104                    plan = Plan.DeserializePlan(property.Value);
 8105                    continue;
 106                }
 272107                if (property.NameEquals("properties"))
 108                {
 52109                    if (property.Value.ValueKind == JsonValueKind.Null)
 110                    {
 111                        continue;
 112                    }
 52113                    properties = property.Value.GetObject();
 52114                    continue;
 115                }
 220116                if (property.NameEquals("kind"))
 117                {
 16118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 16122                    kind = property.Value.GetString();
 16123                    continue;
 124                }
 204125                if (property.NameEquals("managedBy"))
 126                {
 0127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 0131                    managedBy = property.Value.GetString();
 0132                    continue;
 133                }
 204134                if (property.NameEquals("sku"))
 135                {
 24136                    if (property.Value.ValueKind == JsonValueKind.Null)
 137                    {
 138                        continue;
 139                    }
 24140                    sku = Sku.DeserializeSku(property.Value);
 24141                    continue;
 142                }
 180143                if (property.NameEquals("identity"))
 144                {
 4145                    if (property.Value.ValueKind == JsonValueKind.Null)
 146                    {
 147                        continue;
 148                    }
 4149                    identity = Identity.DeserializeIdentity(property.Value);
 4150                    continue;
 151                }
 176152                if (property.NameEquals("id"))
 153                {
 32154                    if (property.Value.ValueKind == JsonValueKind.Null)
 155                    {
 156                        continue;
 157                    }
 32158                    id = property.Value.GetString();
 32159                    continue;
 160                }
 144161                if (property.NameEquals("name"))
 162                {
 32163                    if (property.Value.ValueKind == JsonValueKind.Null)
 164                    {
 165                        continue;
 166                    }
 32167                    name = property.Value.GetString();
 32168                    continue;
 169                }
 112170                if (property.NameEquals("type"))
 171                {
 20172                    if (property.Value.ValueKind == JsonValueKind.Null)
 173                    {
 174                        continue;
 175                    }
 20176                    type = property.Value.GetString();
 20177                    continue;
 178                }
 92179                if (property.NameEquals("location"))
 180                {
 52181                    if (property.Value.ValueKind == JsonValueKind.Null)
 182                    {
 183                        continue;
 184                    }
 52185                    location = property.Value.GetString();
 52186                    continue;
 187                }
 40188                if (property.NameEquals("tags"))
 189                {
 32190                    if (property.Value.ValueKind == JsonValueKind.Null)
 191                    {
 192                        continue;
 193                    }
 24194                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 112195                    foreach (var property0 in property.Value.EnumerateObject())
 196                    {
 32197                        if (property0.Value.ValueKind == JsonValueKind.Null)
 198                        {
 0199                            dictionary.Add(property0.Name, null);
 200                        }
 201                        else
 202                        {
 32203                            dictionary.Add(property0.Name, property0.Value.GetString());
 204                        }
 205                    }
 24206                    tags = dictionary;
 207                    continue;
 208                }
 209            }
 52210            return new GenericResource(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity)
 211        }
 212    }
 213}