< Summary

Class:Azure.ResourceManager.EventHubs.Models.TrackedResource
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\TrackedResource.cs
C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\TrackedResource.Serialization.cs
Covered lines:8
Uncovered lines:53
Coverable lines:61
Total lines:160
Line coverage:13.1% (8 of 61)
Covered branches:0
Total branches:38
Branch coverage:0% (0 of 38)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.EventHubs.Models
 11{
 12    /// <summary> Definition of resource. </summary>
 13    public partial class TrackedResource : Resource
 14    {
 15        /// <summary> Initializes a new instance of TrackedResource. </summary>
 6416        public TrackedResource()
 17        {
 6418        }
 19
 20        /// <summary> Initializes a new instance of TrackedResource. </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>
 14426        internal TrackedResource(string id, string name, string type, string location, IDictionary<string, string> tags)
 27        {
 14428            Location = location;
 14429            Tags = tags;
 14430        }
 31
 32        /// <summary> Resource location. </summary>
 46433        public string Location { get; set; }
 34        /// <summary> Resource tags. </summary>
 47235        public IDictionary<string, string> Tags { get; set; }
 36    }
 37}

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.EventHubs.Models
 13{
 14    public partial class TrackedResource : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Location != null)
 20            {
 021                writer.WritePropertyName("location");
 022                writer.WriteStringValue(Location);
 23            }
 024            if (Tags != null)
 25            {
 026                writer.WritePropertyName("tags");
 027                writer.WriteStartObject();
 028                foreach (var item in Tags)
 29                {
 030                    writer.WritePropertyName(item.Key);
 031                    writer.WriteStringValue(item.Value);
 32                }
 033                writer.WriteEndObject();
 34            }
 035            if (Id != null)
 36            {
 037                writer.WritePropertyName("id");
 038                writer.WriteStringValue(Id);
 39            }
 040            if (Name != null)
 41            {
 042                writer.WritePropertyName("name");
 043                writer.WriteStringValue(Name);
 44            }
 045            if (Type != null)
 46            {
 047                writer.WritePropertyName("type");
 048                writer.WriteStringValue(Type);
 49            }
 050            writer.WriteEndObject();
 051        }
 52
 53        internal static TrackedResource DeserializeTrackedResource(JsonElement element)
 54        {
 055            string location = default;
 056            IDictionary<string, string> tags = default;
 057            string id = default;
 058            string name = default;
 059            string type = default;
 060            foreach (var property in element.EnumerateObject())
 61            {
 062                if (property.NameEquals("location"))
 63                {
 064                    if (property.Value.ValueKind == JsonValueKind.Null)
 65                    {
 66                        continue;
 67                    }
 068                    location = property.Value.GetString();
 069                    continue;
 70                }
 071                if (property.NameEquals("tags"))
 72                {
 073                    if (property.Value.ValueKind == JsonValueKind.Null)
 74                    {
 75                        continue;
 76                    }
 077                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 078                    foreach (var property0 in property.Value.EnumerateObject())
 79                    {
 080                        if (property0.Value.ValueKind == JsonValueKind.Null)
 81                        {
 082                            dictionary.Add(property0.Name, null);
 83                        }
 84                        else
 85                        {
 086                            dictionary.Add(property0.Name, property0.Value.GetString());
 87                        }
 88                    }
 089                    tags = dictionary;
 090                    continue;
 91                }
 092                if (property.NameEquals("id"))
 93                {
 094                    if (property.Value.ValueKind == JsonValueKind.Null)
 95                    {
 96                        continue;
 97                    }
 098                    id = property.Value.GetString();
 099                    continue;
 100                }
 0101                if (property.NameEquals("name"))
 102                {
 0103                    if (property.Value.ValueKind == JsonValueKind.Null)
 104                    {
 105                        continue;
 106                    }
 0107                    name = property.Value.GetString();
 0108                    continue;
 109                }
 0110                if (property.NameEquals("type"))
 111                {
 0112                    if (property.Value.ValueKind == JsonValueKind.Null)
 113                    {
 114                        continue;
 115                    }
 0116                    type = property.Value.GetString();
 117                    continue;
 118                }
 119            }
 0120            return new TrackedResource(id, name, type, location, tags);
 121        }
 122    }
 123}