< Summary

Class:Azure.ResourceManager.Storage.Models.IPRule
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\IPRule.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\IPRule.Serialization.cs
Covered lines:29
Uncovered lines:1
Coverable lines:30
Total lines:94
Line coverage:96.6% (29 of 30)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
.ctor(...)-100%100%
get_IPAddressOrRange()-100%100%
get_Action()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeIPRule(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\IPRule.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;
 9
 10namespace Azure.ResourceManager.Storage.Models
 11{
 12    /// <summary> IP rule with specific IP or IP range in CIDR format. </summary>
 13    public partial class IPRule
 14    {
 15        /// <summary> Initializes a new instance of IPRule. </summary>
 16        /// <param name="iPAddressOrRange"> Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. <
 1217        public IPRule(string iPAddressOrRange)
 18        {
 1219            if (iPAddressOrRange == null)
 20            {
 021                throw new ArgumentNullException(nameof(iPAddressOrRange));
 22            }
 23
 1224            IPAddressOrRange = iPAddressOrRange;
 1225            Action = "Allow";
 1226        }
 27
 28        /// <summary> Initializes a new instance of IPRule. </summary>
 29        /// <param name="iPAddressOrRange"> Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. <
 30        /// <param name="action"> The action of IP ACL rule. </param>
 9631        internal IPRule(string iPAddressOrRange, string action)
 32        {
 9633            IPAddressOrRange = iPAddressOrRange;
 9634            Action = action;
 9635        }
 36
 37        /// <summary> Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. </summary>
 13638        public string IPAddressOrRange { get; set; }
 39        /// <summary> The action of IP ACL rule. </summary>
 15640        public string Action { get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\IPRule.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.Storage.Models
 12{
 13    public partial class IPRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            writer.WritePropertyName("value");
 1619            writer.WriteStringValue(IPAddressOrRange);
 1620            if (Action != null)
 21            {
 1622                writer.WritePropertyName("action");
 1623                writer.WriteStringValue(Action);
 24            }
 1625            writer.WriteEndObject();
 1626        }
 27
 28        internal static IPRule DeserializeIPRule(JsonElement element)
 29        {
 9630            string value = default;
 9631            string action = default;
 57632            foreach (var property in element.EnumerateObject())
 33            {
 19234                if (property.NameEquals("value"))
 35                {
 9636                    value = property.Value.GetString();
 9637                    continue;
 38                }
 9639                if (property.NameEquals("action"))
 40                {
 9641                    if (property.Value.ValueKind == JsonValueKind.Null)
 42                    {
 43                        continue;
 44                    }
 9645                    action = property.Value.GetString();
 46                    continue;
 47                }
 48            }
 9649            return new IPRule(value, action);
 50        }
 51    }
 52}