< Summary

Class:Azure.ResourceManager.Network.Models.TrafficSelectorPolicy
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\TrafficSelectorPolicy.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\TrafficSelectorPolicy.Serialization.cs
Covered lines:0
Uncovered lines:46
Coverable lines:46
Total lines:129
Line coverage:0% (0 of 46)
Covered branches:0
Total branches:26
Branch coverage:0% (0 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_LocalAddressRanges()-0%100%
get_RemoteAddressRanges()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeTrafficSelectorPolicy(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\TrafficSelectorPolicy.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;
 9using System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    /// <summary> An traffic selector policy for a virtual network gateway connection. </summary>
 15    public partial class TrafficSelectorPolicy
 16    {
 17        /// <summary> Initializes a new instance of TrafficSelectorPolicy. </summary>
 18        /// <param name="localAddressRanges"> A collection of local address spaces in CIDR format. </param>
 19        /// <param name="remoteAddressRanges"> A collection of remote address spaces in CIDR format. </param>
 020        public TrafficSelectorPolicy(IEnumerable<string> localAddressRanges, IEnumerable<string> remoteAddressRanges)
 21        {
 022            if (localAddressRanges == null)
 23            {
 024                throw new ArgumentNullException(nameof(localAddressRanges));
 25            }
 026            if (remoteAddressRanges == null)
 27            {
 028                throw new ArgumentNullException(nameof(remoteAddressRanges));
 29            }
 30
 031            LocalAddressRanges = localAddressRanges.ToList();
 032            RemoteAddressRanges = remoteAddressRanges.ToList();
 033        }
 34
 35        /// <summary> Initializes a new instance of TrafficSelectorPolicy. </summary>
 36        /// <param name="localAddressRanges"> A collection of local address spaces in CIDR format. </param>
 37        /// <param name="remoteAddressRanges"> A collection of remote address spaces in CIDR format. </param>
 038        internal TrafficSelectorPolicy(IList<string> localAddressRanges, IList<string> remoteAddressRanges)
 39        {
 040            LocalAddressRanges = localAddressRanges ?? new List<string>();
 041            RemoteAddressRanges = remoteAddressRanges ?? new List<string>();
 042        }
 43
 44        /// <summary> A collection of local address spaces in CIDR format. </summary>
 045        public IList<string> LocalAddressRanges { get; }
 46        /// <summary> A collection of remote address spaces in CIDR format. </summary>
 047        public IList<string> RemoteAddressRanges { get; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\TrafficSelectorPolicy.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 TrafficSelectorPolicy : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("localAddressRanges");
 020            writer.WriteStartArray();
 021            foreach (var item in LocalAddressRanges)
 22            {
 023                writer.WriteStringValue(item);
 24            }
 025            writer.WriteEndArray();
 026            writer.WritePropertyName("remoteAddressRanges");
 027            writer.WriteStartArray();
 028            foreach (var item in RemoteAddressRanges)
 29            {
 030                writer.WriteStringValue(item);
 31            }
 032            writer.WriteEndArray();
 033            writer.WriteEndObject();
 034        }
 35
 36        internal static TrafficSelectorPolicy DeserializeTrafficSelectorPolicy(JsonElement element)
 37        {
 038            IList<string> localAddressRanges = default;
 039            IList<string> remoteAddressRanges = default;
 040            foreach (var property in element.EnumerateObject())
 41            {
 042                if (property.NameEquals("localAddressRanges"))
 43                {
 044                    List<string> array = new List<string>();
 045                    foreach (var item in property.Value.EnumerateArray())
 46                    {
 047                        if (item.ValueKind == JsonValueKind.Null)
 48                        {
 049                            array.Add(null);
 50                        }
 51                        else
 52                        {
 053                            array.Add(item.GetString());
 54                        }
 55                    }
 056                    localAddressRanges = array;
 057                    continue;
 58                }
 059                if (property.NameEquals("remoteAddressRanges"))
 60                {
 061                    List<string> array = new List<string>();
 062                    foreach (var item in property.Value.EnumerateArray())
 63                    {
 064                        if (item.ValueKind == JsonValueKind.Null)
 65                        {
 066                            array.Add(null);
 67                        }
 68                        else
 69                        {
 070                            array.Add(item.GetString());
 71                        }
 72                    }
 073                    remoteAddressRanges = array;
 74                    continue;
 75                }
 76            }
 077            return new TrafficSelectorPolicy(localAddressRanges, remoteAddressRanges);
 78        }
 79    }
 80}