< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_RuleId()-0%100%
get_State()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeManagedRuleOverride(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleOverride.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.Network.Models
 11{
 12    /// <summary> Defines a managed rule group override setting. </summary>
 13    public partial class ManagedRuleOverride
 14    {
 15        /// <summary> Initializes a new instance of ManagedRuleOverride. </summary>
 16        /// <param name="ruleId"> Identifier for the managed rule. </param>
 017        public ManagedRuleOverride(string ruleId)
 18        {
 019            if (ruleId == null)
 20            {
 021                throw new ArgumentNullException(nameof(ruleId));
 22            }
 23
 024            RuleId = ruleId;
 025            State = "Disabled";
 026        }
 27
 28        /// <summary> Initializes a new instance of ManagedRuleOverride. </summary>
 29        /// <param name="ruleId"> Identifier for the managed rule. </param>
 30        /// <param name="state"> The state of the managed rule. Defaults to Disabled if not specified. </param>
 031        internal ManagedRuleOverride(string ruleId, string state)
 32        {
 033            RuleId = ruleId;
 034            State = state;
 035        }
 36
 37        /// <summary> Identifier for the managed rule. </summary>
 038        public string RuleId { get; set; }
 39        /// <summary> The state of the managed rule. Defaults to Disabled if not specified. </summary>
 040        public string State { get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleOverride.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 ManagedRuleOverride : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("ruleId");
 019            writer.WriteStringValue(RuleId);
 020            if (State != null)
 21            {
 022                writer.WritePropertyName("state");
 023                writer.WriteStringValue(State);
 24            }
 025            writer.WriteEndObject();
 026        }
 27
 28        internal static ManagedRuleOverride DeserializeManagedRuleOverride(JsonElement element)
 29        {
 030            string ruleId = default;
 031            string state = default;
 032            foreach (var property in element.EnumerateObject())
 33            {
 034                if (property.NameEquals("ruleId"))
 35                {
 036                    ruleId = property.Value.GetString();
 037                    continue;
 38                }
 039                if (property.NameEquals("state"))
 40                {
 041                    if (property.Value.ValueKind == JsonValueKind.Null)
 42                    {
 43                        continue;
 44                    }
 045                    state = property.Value.GetString();
 46                    continue;
 47                }
 48            }
 049            return new ManagedRuleOverride(ruleId, state);
 50        }
 51    }
 52}