< Summary

Class:Azure.ResourceManager.Network.Models.BgpServiceCommunity
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpServiceCommunity.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpServiceCommunity.Serialization.cs
Covered lines:41
Uncovered lines:49
Coverable lines:90
Total lines:219
Line coverage:45.5% (41 of 90)
Covered branches:33
Total branches:60
Branch coverage:55% (33 of 60)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_ServiceName()-0%100%
get_BgpCommunities()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeBgpServiceCommunity(...)-75%78.57%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpServiceCommunity.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> Service Community Properties. </summary>
 13    public partial class BgpServiceCommunity : Resource
 14    {
 15        /// <summary> Initializes a new instance of BgpServiceCommunity. </summary>
 016        public BgpServiceCommunity()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of BgpServiceCommunity. </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>
 26        /// <param name="serviceName"> The name of the bgp community. e.g. Skype. </param>
 27        /// <param name="bgpCommunities"> A list of bgp communities. </param>
 71628        internal BgpServiceCommunity(string id, string name, string type, string location, IDictionary<string, string> t
 29        {
 71630            ServiceName = serviceName;
 71631            BgpCommunities = bgpCommunities;
 71632        }
 33
 34        /// <summary> The name of the bgp community. e.g. Skype. </summary>
 035        public string ServiceName { get; set; }
 36        /// <summary> A list of bgp communities. </summary>
 72037        public IList<BGPCommunity> BgpCommunities { get; set; }
 38    }
 39}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\BgpServiceCommunity.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 BgpServiceCommunity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 024            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 029            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 034            if (Location != null)
 35            {
 036                writer.WritePropertyName("location");
 037                writer.WriteStringValue(Location);
 38            }
 039            if (Tags != null)
 40            {
 041                writer.WritePropertyName("tags");
 042                writer.WriteStartObject();
 043                foreach (var item in Tags)
 44                {
 045                    writer.WritePropertyName(item.Key);
 046                    writer.WriteStringValue(item.Value);
 47                }
 048                writer.WriteEndObject();
 49            }
 050            writer.WritePropertyName("properties");
 051            writer.WriteStartObject();
 052            if (ServiceName != null)
 53            {
 054                writer.WritePropertyName("serviceName");
 055                writer.WriteStringValue(ServiceName);
 56            }
 057            if (BgpCommunities != null)
 58            {
 059                writer.WritePropertyName("bgpCommunities");
 060                writer.WriteStartArray();
 061                foreach (var item in BgpCommunities)
 62                {
 063                    writer.WriteObjectValue(item);
 64                }
 065                writer.WriteEndArray();
 66            }
 067            writer.WriteEndObject();
 068            writer.WriteEndObject();
 069        }
 70
 71        internal static BgpServiceCommunity DeserializeBgpServiceCommunity(JsonElement element)
 72        {
 71673            string id = default;
 71674            string name = default;
 71675            string type = default;
 71676            string location = default;
 71677            IDictionary<string, string> tags = default;
 71678            string serviceName = default;
 71679            IList<BGPCommunity> bgpCommunities = default;
 716080            foreach (var property in element.EnumerateObject())
 81            {
 286482                if (property.NameEquals("id"))
 83                {
 71684                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 71688                    id = property.Value.GetString();
 71689                    continue;
 90                }
 214891                if (property.NameEquals("name"))
 92                {
 71693                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 71697                    name = property.Value.GetString();
 71698                    continue;
 99                }
 1432100                if (property.NameEquals("type"))
 101                {
 716102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 104                        continue;
 105                    }
 716106                    type = property.Value.GetString();
 716107                    continue;
 108                }
 716109                if (property.NameEquals("location"))
 110                {
 0111                    if (property.Value.ValueKind == JsonValueKind.Null)
 112                    {
 113                        continue;
 114                    }
 0115                    location = property.Value.GetString();
 0116                    continue;
 117                }
 716118                if (property.NameEquals("tags"))
 119                {
 0120                    if (property.Value.ValueKind == JsonValueKind.Null)
 121                    {
 122                        continue;
 123                    }
 0124                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0125                    foreach (var property0 in property.Value.EnumerateObject())
 126                    {
 0127                        if (property0.Value.ValueKind == JsonValueKind.Null)
 128                        {
 0129                            dictionary.Add(property0.Name, null);
 130                        }
 131                        else
 132                        {
 0133                            dictionary.Add(property0.Name, property0.Value.GetString());
 134                        }
 135                    }
 0136                    tags = dictionary;
 0137                    continue;
 138                }
 716139                if (property.NameEquals("properties"))
 140                {
 4296141                    foreach (var property0 in property.Value.EnumerateObject())
 142                    {
 1432143                        if (property0.NameEquals("serviceName"))
 144                        {
 716145                            if (property0.Value.ValueKind == JsonValueKind.Null)
 146                            {
 147                                continue;
 148                            }
 716149                            serviceName = property0.Value.GetString();
 716150                            continue;
 151                        }
 716152                        if (property0.NameEquals("bgpCommunities"))
 153                        {
 716154                            if (property0.Value.ValueKind == JsonValueKind.Null)
 155                            {
 156                                continue;
 157                            }
 716158                            List<BGPCommunity> array = new List<BGPCommunity>();
 2864159                            foreach (var item in property0.Value.EnumerateArray())
 160                            {
 716161                                if (item.ValueKind == JsonValueKind.Null)
 162                                {
 0163                                    array.Add(null);
 164                                }
 165                                else
 166                                {
 716167                                    array.Add(BGPCommunity.DeserializeBGPCommunity(item));
 168                                }
 169                            }
 716170                            bgpCommunities = array;
 171                            continue;
 172                        }
 173                    }
 174                    continue;
 175                }
 176            }
 716177            return new BgpServiceCommunity(id, name, type, location, tags, serviceName, bgpCommunities);
 178        }
 179    }
 180}