< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Etag()-100%100%
get_AddressPrefix()-100%100%
get_NextHopType()-100%100%
get_NextHopIpAddress()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeRoute(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Route.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.Network.Models
 9{
 10    /// <summary> Route resource. </summary>
 11    public partial class Route : SubResource
 12    {
 13        /// <summary> Initializes a new instance of Route. </summary>
 3614        public Route()
 15        {
 3616        }
 17
 18        /// <summary> Initializes a new instance of Route. </summary>
 19        /// <param name="id"> Resource ID. </param>
 20        /// <param name="name"> The name of the resource that is unique within a resource group. This name can be used t
 21        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 22        /// <param name="addressPrefix"> The destination CIDR to which the route applies. </param>
 23        /// <param name="nextHopType"> The type of Azure hop the packet should be sent to. </param>
 24        /// <param name="nextHopIpAddress"> The IP address packets should be forwarded to. Next hop values are only allo
 25        /// <param name="provisioningState"> The provisioning state of the route resource. </param>
 9626        internal Route(string id, string name, string etag, string addressPrefix, RouteNextHopType? nextHopType, string 
 27        {
 9628            Name = name;
 9629            Etag = etag;
 9630            AddressPrefix = addressPrefix;
 9631            NextHopType = nextHopType;
 9632            NextHopIpAddress = nextHopIpAddress;
 9633            ProvisioningState = provisioningState;
 9634        }
 35
 36        /// <summary> The name of the resource that is unique within a resource group. This name can be used to access t
 37637        public string Name { get; set; }
 38        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 10439        public string Etag { get; }
 40        /// <summary> The destination CIDR to which the route applies. </summary>
 36841        public string AddressPrefix { get; set; }
 42        /// <summary> The type of Azure hop the packet should be sent to. </summary>
 38443        public RouteNextHopType? NextHopType { get; set; }
 44        /// <summary> The IP address packets should be forwarded to. Next hop values are only allowed in routes where th
 30045        public string NextHopIpAddress { get; set; }
 46        /// <summary> The provisioning state of the route resource. </summary>
 10447        public ProvisioningState? ProvisioningState { get; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Route.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.Network.Models
 12{
 13    public partial class Route : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 8817            writer.WriteStartObject();
 8818            if (Name != null)
 19            {
 8820                writer.WritePropertyName("name");
 8821                writer.WriteStringValue(Name);
 22            }
 8823            if (Etag != null)
 24            {
 1625                writer.WritePropertyName("etag");
 1626                writer.WriteStringValue(Etag);
 27            }
 8828            if (Id != null)
 29            {
 1630                writer.WritePropertyName("id");
 1631                writer.WriteStringValue(Id);
 32            }
 8833            writer.WritePropertyName("properties");
 8834            writer.WriteStartObject();
 8835            if (AddressPrefix != null)
 36            {
 8837                writer.WritePropertyName("addressPrefix");
 8838                writer.WriteStringValue(AddressPrefix);
 39            }
 8840            if (NextHopType != null)
 41            {
 8842                writer.WritePropertyName("nextHopType");
 8843                writer.WriteStringValue(NextHopType.Value.ToString());
 44            }
 8845            if (NextHopIpAddress != null)
 46            {
 4047                writer.WritePropertyName("nextHopIpAddress");
 4048                writer.WriteStringValue(NextHopIpAddress);
 49            }
 8850            if (ProvisioningState != null)
 51            {
 1652                writer.WritePropertyName("provisioningState");
 1653                writer.WriteStringValue(ProvisioningState.Value.ToString());
 54            }
 8855            writer.WriteEndObject();
 8856            writer.WriteEndObject();
 8857        }
 58
 59        internal static Route DeserializeRoute(JsonElement element)
 60        {
 9661            string name = default;
 9662            string etag = default;
 9663            string id = default;
 9664            string addressPrefix = default;
 9665            RouteNextHopType? nextHopType = default;
 9666            string nextHopIpAddress = default;
 9667            ProvisioningState? provisioningState = default;
 115268            foreach (var property in element.EnumerateObject())
 69            {
 48070                if (property.NameEquals("name"))
 71                {
 9672                    if (property.Value.ValueKind == JsonValueKind.Null)
 73                    {
 74                        continue;
 75                    }
 9676                    name = property.Value.GetString();
 9677                    continue;
 78                }
 38479                if (property.NameEquals("etag"))
 80                {
 9681                    if (property.Value.ValueKind == JsonValueKind.Null)
 82                    {
 83                        continue;
 84                    }
 9685                    etag = property.Value.GetString();
 9686                    continue;
 87                }
 28888                if (property.NameEquals("id"))
 89                {
 9690                    if (property.Value.ValueKind == JsonValueKind.Null)
 91                    {
 92                        continue;
 93                    }
 9694                    id = property.Value.GetString();
 9695                    continue;
 96                }
 19297                if (property.NameEquals("properties"))
 98                {
 108099                    foreach (var property0 in property.Value.EnumerateObject())
 100                    {
 444101                        if (property0.NameEquals("addressPrefix"))
 102                        {
 96103                            if (property0.Value.ValueKind == JsonValueKind.Null)
 104                            {
 105                                continue;
 106                            }
 96107                            addressPrefix = property0.Value.GetString();
 96108                            continue;
 109                        }
 348110                        if (property0.NameEquals("nextHopType"))
 111                        {
 96112                            if (property0.Value.ValueKind == JsonValueKind.Null)
 113                            {
 114                                continue;
 115                            }
 96116                            nextHopType = new RouteNextHopType(property0.Value.GetString());
 96117                            continue;
 118                        }
 252119                        if (property0.NameEquals("nextHopIpAddress"))
 120                        {
 60121                            if (property0.Value.ValueKind == JsonValueKind.Null)
 122                            {
 123                                continue;
 124                            }
 60125                            nextHopIpAddress = property0.Value.GetString();
 60126                            continue;
 127                        }
 192128                        if (property0.NameEquals("provisioningState"))
 129                        {
 96130                            if (property0.Value.ValueKind == JsonValueKind.Null)
 131                            {
 132                                continue;
 133                            }
 96134                            provisioningState = new ProvisioningState(property0.Value.GetString());
 135                            continue;
 136                        }
 137                    }
 138                    continue;
 139                }
 140            }
 96141            return new Route(id, name, etag, addressPrefix, nextHopType, nextHopIpAddress, provisioningState);
 142        }
 143    }
 144}