< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_RuleType()-0%100%
get_Name()-0%100%
get_Priority()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeFirewallPolicyRule(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyRule.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> Properties of the rule. </summary>
 11    public partial class FirewallPolicyRule
 12    {
 13        /// <summary> Initializes a new instance of FirewallPolicyRule. </summary>
 014        public FirewallPolicyRule()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of FirewallPolicyRule. </summary>
 19        /// <param name="ruleType"> The type of the rule. </param>
 20        /// <param name="name"> The name of the rule. </param>
 21        /// <param name="priority"> Priority of the Firewall Policy Rule resource. </param>
 022        internal FirewallPolicyRule(FirewallPolicyRuleType ruleType, string name, int? priority)
 23        {
 024            RuleType = ruleType;
 025            Name = name;
 026            Priority = priority;
 027        }
 28
 29        /// <summary> The type of the rule. </summary>
 030        internal FirewallPolicyRuleType RuleType { get; set; }
 31        /// <summary> The name of the rule. </summary>
 032        public string Name { get; set; }
 33        /// <summary> Priority of the Firewall Policy Rule resource. </summary>
 034        public int? Priority { get; set; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyRule.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 FirewallPolicyRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("ruleType");
 019            writer.WriteStringValue(RuleType.ToString());
 020            if (Name != null)
 21            {
 022                writer.WritePropertyName("name");
 023                writer.WriteStringValue(Name);
 24            }
 025            if (Priority != null)
 26            {
 027                writer.WritePropertyName("priority");
 028                writer.WriteNumberValue(Priority.Value);
 29            }
 030            writer.WriteEndObject();
 031        }
 32
 33        internal static FirewallPolicyRule DeserializeFirewallPolicyRule(JsonElement element)
 34        {
 035            if (element.TryGetProperty("ruleType", out JsonElement discriminator))
 36            {
 037                switch (discriminator.GetString())
 38                {
 039                    case "FirewallPolicyFilterRule": return FirewallPolicyFilterRule.DeserializeFirewallPolicyFilterRule
 040                    case "FirewallPolicyNatRule": return FirewallPolicyNatRule.DeserializeFirewallPolicyNatRule(element)
 41                }
 42            }
 043            FirewallPolicyRuleType ruleType = default;
 044            string name = default;
 045            int? priority = default;
 046            foreach (var property in element.EnumerateObject())
 47            {
 048                if (property.NameEquals("ruleType"))
 49                {
 050                    ruleType = new FirewallPolicyRuleType(property.Value.GetString());
 051                    continue;
 52                }
 053                if (property.NameEquals("name"))
 54                {
 055                    if (property.Value.ValueKind == JsonValueKind.Null)
 56                    {
 57                        continue;
 58                    }
 059                    name = property.Value.GetString();
 060                    continue;
 61                }
 062                if (property.NameEquals("priority"))
 63                {
 064                    if (property.Value.ValueKind == JsonValueKind.Null)
 65                    {
 66                        continue;
 67                    }
 068                    priority = property.Value.GetInt32();
 69                    continue;
 70                }
 71            }
 072            return new FirewallPolicyRule(ruleType, name, priority);
 73        }
 74    }
 75}