< Summary

Class:Azure.ResourceManager.EventHubs.Models.Resource
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Resource.cs
C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Resource.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%
DeserializeResource(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Resource.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.EventHubs.Models
 9{
 10    /// <summary> The resource definition. </summary>
 11    public partial class Resource
 12    {
 13        /// <summary> Initializes a new instance of Resource. </summary>
 22814        public Resource()
 15        {
 22816        }
 17
 18        /// <summary> Initializes a new instance of Resource. </summary>
 19        /// <param name="id"> Resource ID. </param>
 20        /// <param name="name"> Resource name. </param>
 21        /// <param name="type"> Resource type. </param>
 663222        internal Resource(string id, string name, string type)
 23        {
 663224            Id = id;
 663225            Name = name;
 663226            Type = type;
 663227        }
 28
 29        /// <summary> Resource ID. </summary>
 34030        public string Id { get; }
 31        /// <summary> Resource name. </summary>
 66632        public string Name { get; }
 33        /// <summary> Resource type. </summary>
 30834        public string Type { get; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Resource.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.EventHubs.Models
 12{
 13    public partial class Resource : 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 Resource DeserializeResource(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 Resource(id, name, type);
 72        }
 73    }
 74}