< Summary

Class:Azure.ResourceManager.Compute.Models.NetworkInterfaceReference
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\NetworkInterfaceReference.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\NetworkInterfaceReference.Serialization.cs
Covered lines:31
Uncovered lines:0
Coverable lines:31
Total lines:98
Line coverage:100% (31 of 31)
Covered branches:18
Total branches:18
Branch coverage:100% (18 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Primary()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeNetworkInterfaceReference(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\NetworkInterfaceReference.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.Compute.Models
 9{
 10    /// <summary> Describes a network interface reference. </summary>
 11    public partial class NetworkInterfaceReference : SubResource
 12    {
 13        /// <summary> Initializes a new instance of NetworkInterfaceReference. </summary>
 12414        public NetworkInterfaceReference()
 15        {
 12416        }
 17
 18        /// <summary> Initializes a new instance of NetworkInterfaceReference. </summary>
 19        /// <param name="id"> Resource Id. </param>
 20        /// <param name="primary"> Specifies the primary network interface in case the virtual machine has more than 1 n
 44821        internal NetworkInterfaceReference(string id, bool? primary) : base(id)
 22        {
 44823            Primary = primary;
 44824        }
 25
 26        /// <summary> Specifies the primary network interface in case the virtual machine has more than 1 network interf
 75627        public bool? Primary { get; set; }
 28    }
 29}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\NetworkInterfaceReference.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.Compute.Models
 12{
 13    public partial class NetworkInterfaceReference : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 26017            writer.WriteStartObject();
 26018            if (Id != null)
 19            {
 26020                writer.WritePropertyName("id");
 26021                writer.WriteStringValue(Id);
 22            }
 26023            writer.WritePropertyName("properties");
 26024            writer.WriteStartObject();
 26025            if (Primary != null)
 26            {
 3227                writer.WritePropertyName("primary");
 3228                writer.WriteBooleanValue(Primary.Value);
 29            }
 26030            writer.WriteEndObject();
 26031            writer.WriteEndObject();
 26032        }
 33
 34        internal static NetworkInterfaceReference DeserializeNetworkInterfaceReference(JsonElement element)
 35        {
 44836            string id = default;
 44837            bool? primary = default;
 185638            foreach (var property in element.EnumerateObject())
 39            {
 48040                if (property.NameEquals("id"))
 41                {
 44842                    if (property.Value.ValueKind == JsonValueKind.Null)
 43                    {
 44                        continue;
 45                    }
 44846                    id = property.Value.GetString();
 44847                    continue;
 48                }
 3249                if (property.NameEquals("properties"))
 50                {
 12851                    foreach (var property0 in property.Value.EnumerateObject())
 52                    {
 3253                        if (property0.NameEquals("primary"))
 54                        {
 3255                            if (property0.Value.ValueKind == JsonValueKind.Null)
 56                            {
 57                                continue;
 58                            }
 3259                            primary = property0.Value.GetBoolean();
 60                            continue;
 61                        }
 62                    }
 63                    continue;
 64                }
 65            }
 44866            return new NetworkInterfaceReference(id, primary);
 67        }
 68    }
 69}