< Summary

Class:Azure.ResourceManager.Storage.Models.TrackedResource
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\TrackedResource.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\TrackedResource.Serialization.cs
Covered lines:6
Uncovered lines:56
Coverable lines:62
Total lines:161
Line coverage:9.6% (6 of 62)
Covered branches:0
Total branches:36
Branch coverage:0% (0 of 36)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Tags()-100%100%
get_Location()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeTrackedResource(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\TrackedResource.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.Storage.Models
 12{
 13    /// <summary> The resource model definition for a ARM tracked top level resource. </summary>
 14    public partial class TrackedResource : Resource
 15    {
 16        /// <summary> Initializes a new instance of TrackedResource. </summary>
 17        /// <param name="location"> The geo-location where the resource lives. </param>
 018        public TrackedResource(string location)
 19        {
 020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 24
 025            Location = location;
 026        }
 27
 28        /// <summary> Initializes a new instance of TrackedResource. </summary>
 29        /// <param name="id"> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourc
 30        /// <param name="name"> The name of the resource. </param>
 31        /// <param name="type"> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/sto
 32        /// <param name="tags"> Resource tags. </param>
 33        /// <param name="location"> The geo-location where the resource lives. </param>
 83634        internal TrackedResource(string id, string name, string type, IDictionary<string, string> tags, string location)
 35        {
 83636            Tags = tags;
 83637            Location = location;
 83638        }
 39
 40        /// <summary> Resource tags. </summary>
 114041        public IDictionary<string, string> Tags { get; set; }
 42        /// <summary> The geo-location where the resource lives. </summary>
 124843        public string Location { get; set; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\TrackedResource.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.Storage.Models
 13{
 14    public partial class TrackedResource : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Tags != null)
 20            {
 021                writer.WritePropertyName("tags");
 022                writer.WriteStartObject();
 023                foreach (var item in Tags)
 24                {
 025                    writer.WritePropertyName(item.Key);
 026                    writer.WriteStringValue(item.Value);
 27                }
 028                writer.WriteEndObject();
 29            }
 030            writer.WritePropertyName("location");
 031            writer.WriteStringValue(Location);
 032            if (Id != null)
 33            {
 034                writer.WritePropertyName("id");
 035                writer.WriteStringValue(Id);
 36            }
 037            if (Name != null)
 38            {
 039                writer.WritePropertyName("name");
 040                writer.WriteStringValue(Name);
 41            }
 042            if (Type != null)
 43            {
 044                writer.WritePropertyName("type");
 045                writer.WriteStringValue(Type);
 46            }
 047            writer.WriteEndObject();
 048        }
 49
 50        internal static TrackedResource DeserializeTrackedResource(JsonElement element)
 51        {
 052            IDictionary<string, string> tags = default;
 053            string location = default;
 054            string id = default;
 055            string name = default;
 056            string type = default;
 057            foreach (var property in element.EnumerateObject())
 58            {
 059                if (property.NameEquals("tags"))
 60                {
 061                    if (property.Value.ValueKind == JsonValueKind.Null)
 62                    {
 63                        continue;
 64                    }
 065                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 066                    foreach (var property0 in property.Value.EnumerateObject())
 67                    {
 068                        if (property0.Value.ValueKind == JsonValueKind.Null)
 69                        {
 070                            dictionary.Add(property0.Name, null);
 71                        }
 72                        else
 73                        {
 074                            dictionary.Add(property0.Name, property0.Value.GetString());
 75                        }
 76                    }
 077                    tags = dictionary;
 078                    continue;
 79                }
 080                if (property.NameEquals("location"))
 81                {
 082                    location = property.Value.GetString();
 083                    continue;
 84                }
 085                if (property.NameEquals("id"))
 86                {
 087                    if (property.Value.ValueKind == JsonValueKind.Null)
 88                    {
 89                        continue;
 90                    }
 091                    id = property.Value.GetString();
 092                    continue;
 93                }
 094                if (property.NameEquals("name"))
 95                {
 096                    if (property.Value.ValueKind == JsonValueKind.Null)
 97                    {
 98                        continue;
 99                    }
 0100                    name = property.Value.GetString();
 0101                    continue;
 102                }
 0103                if (property.NameEquals("type"))
 104                {
 0105                    if (property.Value.ValueKind == JsonValueKind.Null)
 106                    {
 107                        continue;
 108                    }
 0109                    type = property.Value.GetString();
 110                    continue;
 111                }
 112            }
 0113            return new TrackedResource(id, name, type, tags, location);
 114        }
 115    }
 116}