< Summary

Class:Azure.ResourceManager.Network.Models.BgpSettings
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpSettings.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpSettings.Serialization.cs
Covered lines:55
Uncovered lines:1
Coverable lines:56
Total lines:149
Line coverage:98.2% (55 of 56)
Covered branches:31
Total branches:32
Branch coverage:96.8% (31 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Asn()-100%100%
get_BgpPeeringAddress()-100%100%
get_PeerWeight()-100%100%
get_BgpPeeringAddresses()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeBgpSettings(...)-96.15%95.45%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpSettings.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.Network.Models
 11{
 12    /// <summary> BGP settings details. </summary>
 13    public partial class BgpSettings
 14    {
 15        /// <summary> Initializes a new instance of BgpSettings. </summary>
 816        public BgpSettings()
 17        {
 818        }
 19
 20        /// <summary> Initializes a new instance of BgpSettings. </summary>
 21        /// <param name="asn"> The BGP speaker&apos;s ASN. </param>
 22        /// <param name="bgpPeeringAddress"> The BGP peering address and BGP identifier of this BGP speaker. </param>
 23        /// <param name="peerWeight"> The weight added to routes learned from this BGP speaker. </param>
 24        /// <param name="bgpPeeringAddresses"> BGP peering address with IP configuration ID for virtual network gateway.
 4025        internal BgpSettings(long? asn, string bgpPeeringAddress, int? peerWeight, IList<IPConfigurationBgpPeeringAddres
 26        {
 4027            Asn = asn;
 4028            BgpPeeringAddress = bgpPeeringAddress;
 4029            PeerWeight = peerWeight;
 4030            BgpPeeringAddresses = bgpPeeringAddresses;
 4031        }
 32
 33        /// <summary> The BGP speaker&apos;s ASN. </summary>
 20834        public long? Asn { get; set; }
 35        /// <summary> The BGP peering address and BGP identifier of this BGP speaker. </summary>
 20436        public string BgpPeeringAddress { get; set; }
 37        /// <summary> The weight added to routes learned from this BGP speaker. </summary>
 20838        public int? PeerWeight { get; set; }
 39        /// <summary> BGP peering address with IP configuration ID for virtual network gateway. </summary>
 17640        public IList<IPConfigurationBgpPeeringAddress> BgpPeeringAddresses { get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpSettings.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.Network.Models
 13{
 14    public partial class BgpSettings : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 8018            writer.WriteStartObject();
 8019            if (Asn != null)
 20            {
 8021                writer.WritePropertyName("asn");
 8022                writer.WriteNumberValue(Asn.Value);
 23            }
 8024            if (BgpPeeringAddress != null)
 25            {
 7226                writer.WritePropertyName("bgpPeeringAddress");
 7227                writer.WriteStringValue(BgpPeeringAddress);
 28            }
 8029            if (PeerWeight != null)
 30            {
 8031                writer.WritePropertyName("peerWeight");
 8032                writer.WriteNumberValue(PeerWeight.Value);
 33            }
 8034            if (BgpPeeringAddresses != null)
 35            {
 5636                writer.WritePropertyName("bgpPeeringAddresses");
 5637                writer.WriteStartArray();
 22438                foreach (var item in BgpPeeringAddresses)
 39                {
 5640                    writer.WriteObjectValue(item);
 41                }
 5642                writer.WriteEndArray();
 43            }
 8044            writer.WriteEndObject();
 8045        }
 46
 47        internal static BgpSettings DeserializeBgpSettings(JsonElement element)
 48        {
 4049            long? asn = default;
 4050            string bgpPeeringAddress = default;
 4051            int? peerWeight = default;
 4052            IList<IPConfigurationBgpPeeringAddress> bgpPeeringAddresses = default;
 38453            foreach (var property in element.EnumerateObject())
 54            {
 15255                if (property.NameEquals("asn"))
 56                {
 4057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 4061                    asn = property.Value.GetInt64();
 4062                    continue;
 63                }
 11264                if (property.NameEquals("bgpPeeringAddress"))
 65                {
 4066                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 4070                    bgpPeeringAddress = property.Value.GetString();
 4071                    continue;
 72                }
 7273                if (property.NameEquals("peerWeight"))
 74                {
 4075                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 4079                    peerWeight = property.Value.GetInt32();
 4080                    continue;
 81                }
 3282                if (property.NameEquals("bgpPeeringAddresses"))
 83                {
 3284                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 3288                    List<IPConfigurationBgpPeeringAddress> array = new List<IPConfigurationBgpPeeringAddress>();
 12889                    foreach (var item in property.Value.EnumerateArray())
 90                    {
 3291                        if (item.ValueKind == JsonValueKind.Null)
 92                        {
 093                            array.Add(null);
 94                        }
 95                        else
 96                        {
 3297                            array.Add(IPConfigurationBgpPeeringAddress.DeserializeIPConfigurationBgpPeeringAddress(item)
 98                        }
 99                    }
 32100                    bgpPeeringAddresses = array;
 101                    continue;
 102                }
 103            }
 40104            return new BgpSettings(asn, bgpPeeringAddress, peerWeight, bgpPeeringAddresses);
 105        }
 106    }
 107}