< Summary

Class:Azure.ResourceManager.Resources.Models.GenericResourceExpanded
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResourceExpanded.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResourceExpanded.Serialization.cs
Covered lines:68
Uncovered lines:67
Coverable lines:135
Total lines:309
Line coverage:50.3% (68 of 135)
Covered branches:53
Total branches:92
Branch coverage:57.6% (53 of 92)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_CreatedTime()-0%100%
get_ChangedTime()-0%100%
get_ProvisioningState()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeGenericResourceExpanded(...)-82.89%85.48%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResourceExpanded.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Resources.Models
 12{
 13    /// <summary> Resource information. </summary>
 14    public partial class GenericResourceExpanded : GenericResource
 15    {
 16        /// <summary> Initializes a new instance of GenericResourceExpanded. </summary>
 017        public GenericResourceExpanded()
 18        {
 019        }
 20
 21        /// <summary> Initializes a new instance of GenericResourceExpanded. </summary>
 22        /// <param name="id"> Resource ID. </param>
 23        /// <param name="name"> Resource name. </param>
 24        /// <param name="type"> Resource type. </param>
 25        /// <param name="location"> Resource location. </param>
 26        /// <param name="tags"> Resource tags. </param>
 27        /// <param name="plan"> The plan of the resource. </param>
 28        /// <param name="properties"> The resource properties. </param>
 29        /// <param name="kind"> The kind of the resource. </param>
 30        /// <param name="managedBy"> ID of the resource that manages this resource. </param>
 31        /// <param name="sku"> The SKU of the resource. </param>
 32        /// <param name="identity"> The identity of the resource. </param>
 33        /// <param name="createdTime"> The created time of the resource. This is only present if requested via the $expa
 34        /// <param name="changedTime"> The changed time of the resource. This is only present if requested via the $expa
 35        /// <param name="provisioningState"> The provisioning state of the resource. This is only present if requested v
 25036        internal GenericResourceExpanded(string id, string name, string type, string location, IDictionary<string, strin
 37        {
 25038            CreatedTime = createdTime;
 25039            ChangedTime = changedTime;
 25040            ProvisioningState = provisioningState;
 25041        }
 42
 43        /// <summary> The created time of the resource. This is only present if requested via the $expand query paramete
 044        public DateTimeOffset? CreatedTime { get; }
 45        /// <summary> The changed time of the resource. This is only present if requested via the $expand query paramete
 046        public DateTimeOffset? ChangedTime { get; }
 47        /// <summary> The provisioning state of the resource. This is only present if requested via the $expand query pa
 048        public string ProvisioningState { get; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\GenericResourceExpanded.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.Resources.Models
 14{
 15    public partial class GenericResourceExpanded : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            if (CreatedTime != null)
 21            {
 022                writer.WritePropertyName("createdTime");
 023                writer.WriteStringValue(CreatedTime.Value, "O");
 24            }
 025            if (ChangedTime != null)
 26            {
 027                writer.WritePropertyName("changedTime");
 028                writer.WriteStringValue(ChangedTime.Value, "O");
 29            }
 030            if (ProvisioningState != null)
 31            {
 032                writer.WritePropertyName("provisioningState");
 033                writer.WriteStringValue(ProvisioningState);
 34            }
 035            if (Plan != null)
 36            {
 037                writer.WritePropertyName("plan");
 038                writer.WriteObjectValue(Plan);
 39            }
 040            if (Properties != null)
 41            {
 042                writer.WritePropertyName("properties");
 043                writer.WriteObjectValue(Properties);
 44            }
 045            if (Kind != null)
 46            {
 047                writer.WritePropertyName("kind");
 048                writer.WriteStringValue(Kind);
 49            }
 050            if (ManagedBy != null)
 51            {
 052                writer.WritePropertyName("managedBy");
 053                writer.WriteStringValue(ManagedBy);
 54            }
 055            if (Sku != null)
 56            {
 057                writer.WritePropertyName("sku");
 058                writer.WriteObjectValue(Sku);
 59            }
 060            if (Identity != null)
 61            {
 062                writer.WritePropertyName("identity");
 063                writer.WriteObjectValue(Identity);
 64            }
 065            if (Id != null)
 66            {
 067                writer.WritePropertyName("id");
 068                writer.WriteStringValue(Id);
 69            }
 070            if (Name != null)
 71            {
 072                writer.WritePropertyName("name");
 073                writer.WriteStringValue(Name);
 74            }
 075            if (Type != null)
 76            {
 077                writer.WritePropertyName("type");
 078                writer.WriteStringValue(Type);
 79            }
 080            if (Location != null)
 81            {
 082                writer.WritePropertyName("location");
 083                writer.WriteStringValue(Location);
 84            }
 085            if (Tags != null)
 86            {
 087                writer.WritePropertyName("tags");
 088                writer.WriteStartObject();
 089                foreach (var item in Tags)
 90                {
 091                    writer.WritePropertyName(item.Key);
 092                    writer.WriteStringValue(item.Value);
 93                }
 094                writer.WriteEndObject();
 95            }
 096            writer.WriteEndObject();
 097        }
 98
 99        internal static GenericResourceExpanded DeserializeGenericResourceExpanded(JsonElement element)
 100        {
 250101            DateTimeOffset? createdTime = default;
 250102            DateTimeOffset? changedTime = default;
 250103            string provisioningState = default;
 250104            Plan plan = default;
 250105            object properties = default;
 250106            string kind = default;
 250107            string managedBy = default;
 250108            Sku sku = default;
 250109            Identity identity = default;
 250110            string id = default;
 250111            string name = default;
 250112            string type = default;
 250113            string location = default;
 250114            IDictionary<string, string> tags = default;
 3160115            foreach (var property in element.EnumerateObject())
 116            {
 1330117                if (property.NameEquals("createdTime"))
 118                {
 0119                    if (property.Value.ValueKind == JsonValueKind.Null)
 120                    {
 121                        continue;
 122                    }
 0123                    createdTime = property.Value.GetDateTimeOffset("O");
 0124                    continue;
 125                }
 1330126                if (property.NameEquals("changedTime"))
 127                {
 0128                    if (property.Value.ValueKind == JsonValueKind.Null)
 129                    {
 130                        continue;
 131                    }
 0132                    changedTime = property.Value.GetDateTimeOffset("O");
 0133                    continue;
 134                }
 1330135                if (property.NameEquals("provisioningState"))
 136                {
 0137                    if (property.Value.ValueKind == JsonValueKind.Null)
 138                    {
 139                        continue;
 140                    }
 0141                    provisioningState = property.Value.GetString();
 0142                    continue;
 143                }
 1330144                if (property.NameEquals("plan"))
 145                {
 2146                    if (property.Value.ValueKind == JsonValueKind.Null)
 147                    {
 148                        continue;
 149                    }
 2150                    plan = Plan.DeserializePlan(property.Value);
 2151                    continue;
 152                }
 1328153                if (property.NameEquals("properties"))
 154                {
 8155                    if (property.Value.ValueKind == JsonValueKind.Null)
 156                    {
 157                        continue;
 158                    }
 8159                    properties = property.Value.GetObject();
 8160                    continue;
 161                }
 1320162                if (property.NameEquals("kind"))
 163                {
 80164                    if (property.Value.ValueKind == JsonValueKind.Null)
 165                    {
 166                        continue;
 167                    }
 80168                    kind = property.Value.GetString();
 80169                    continue;
 170                }
 1240171                if (property.NameEquals("managedBy"))
 172                {
 20173                    if (property.Value.ValueKind == JsonValueKind.Null)
 174                    {
 175                        continue;
 176                    }
 20177                    managedBy = property.Value.GetString();
 20178                    continue;
 179                }
 1220180                if (property.NameEquals("sku"))
 181                {
 120182                    if (property.Value.ValueKind == JsonValueKind.Null)
 183                    {
 184                        continue;
 185                    }
 120186                    sku = Sku.DeserializeSku(property.Value);
 120187                    continue;
 188                }
 1100189                if (property.NameEquals("identity"))
 190                {
 0191                    if (property.Value.ValueKind == JsonValueKind.Null)
 192                    {
 193                        continue;
 194                    }
 0195                    identity = Identity.DeserializeIdentity(property.Value);
 0196                    continue;
 197                }
 1100198                if (property.NameEquals("id"))
 199                {
 250200                    if (property.Value.ValueKind == JsonValueKind.Null)
 201                    {
 202                        continue;
 203                    }
 250204                    id = property.Value.GetString();
 250205                    continue;
 206                }
 850207                if (property.NameEquals("name"))
 208                {
 250209                    if (property.Value.ValueKind == JsonValueKind.Null)
 210                    {
 211                        continue;
 212                    }
 250213                    name = property.Value.GetString();
 250214                    continue;
 215                }
 600216                if (property.NameEquals("type"))
 217                {
 234218                    if (property.Value.ValueKind == JsonValueKind.Null)
 219                    {
 220                        continue;
 221                    }
 234222                    type = property.Value.GetString();
 234223                    continue;
 224                }
 366225                if (property.NameEquals("location"))
 226                {
 250227                    if (property.Value.ValueKind == JsonValueKind.Null)
 228                    {
 229                        continue;
 230                    }
 250231                    location = property.Value.GetString();
 250232                    continue;
 233                }
 116234                if (property.NameEquals("tags"))
 235                {
 100236                    if (property.Value.ValueKind == JsonValueKind.Null)
 237                    {
 238                        continue;
 239                    }
 100240                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 276241                    foreach (var property0 in property.Value.EnumerateObject())
 242                    {
 38243                        if (property0.Value.ValueKind == JsonValueKind.Null)
 244                        {
 0245                            dictionary.Add(property0.Name, null);
 246                        }
 247                        else
 248                        {
 38249                            dictionary.Add(property0.Name, property0.Value.GetString());
 250                        }
 251                    }
 100252                    tags = dictionary;
 253                    continue;
 254                }
 255            }
 250256            return new GenericResourceExpanded(id, name, type, location, tags, plan, properties, kind, managedBy, sku, i
 257        }
 258    }
 259}