< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_MatchVariables()-0%100%
get_Operator()-0%100%
get_NegationConditon()-0%100%
get_MatchValues()-0%100%
get_Transforms()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeMatchCondition(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\MatchCondition.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> Define match conditions. </summary>
 15    public partial class MatchCondition
 16    {
 17        /// <summary> Initializes a new instance of MatchCondition. </summary>
 18        /// <param name="matchVariables"> List of match variables. </param>
 19        /// <param name="operator"> The operator to be matched. </param>
 20        /// <param name="matchValues"> Match value. </param>
 021        public MatchCondition(IEnumerable<MatchVariable> matchVariables, WebApplicationFirewallOperator @operator, IEnum
 22        {
 023            if (matchVariables == null)
 24            {
 025                throw new ArgumentNullException(nameof(matchVariables));
 26            }
 027            if (matchValues == null)
 28            {
 029                throw new ArgumentNullException(nameof(matchValues));
 30            }
 31
 032            MatchVariables = matchVariables.ToList();
 033            Operator = @operator;
 034            MatchValues = matchValues.ToList();
 035        }
 36
 37        /// <summary> Initializes a new instance of MatchCondition. </summary>
 38        /// <param name="matchVariables"> List of match variables. </param>
 39        /// <param name="operator"> The operator to be matched. </param>
 40        /// <param name="negationConditon"> Whether this is negate condition or not. </param>
 41        /// <param name="matchValues"> Match value. </param>
 42        /// <param name="transforms"> List of transforms. </param>
 043        internal MatchCondition(IList<MatchVariable> matchVariables, WebApplicationFirewallOperator @operator, bool? neg
 44        {
 045            MatchVariables = matchVariables ?? new List<MatchVariable>();
 046            Operator = @operator;
 047            NegationConditon = negationConditon;
 048            MatchValues = matchValues ?? new List<string>();
 049            Transforms = transforms;
 050        }
 51
 52        /// <summary> List of match variables. </summary>
 053        public IList<MatchVariable> MatchVariables { get; }
 54        /// <summary> The operator to be matched. </summary>
 055        public WebApplicationFirewallOperator Operator { get; set; }
 56        /// <summary> Whether this is negate condition or not. </summary>
 057        public bool? NegationConditon { get; set; }
 58        /// <summary> Match value. </summary>
 059        public IList<string> MatchValues { get; }
 60        /// <summary> List of transforms. </summary>
 061        public IList<WebApplicationFirewallTransform> Transforms { get; set; }
 62    }
 63}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\MatchCondition.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 MatchCondition : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("matchVariables");
 020            writer.WriteStartArray();
 021            foreach (var item in MatchVariables)
 22            {
 023                writer.WriteObjectValue(item);
 24            }
 025            writer.WriteEndArray();
 026            writer.WritePropertyName("operator");
 027            writer.WriteStringValue(Operator.ToString());
 028            if (NegationConditon != null)
 29            {
 030                writer.WritePropertyName("negationConditon");
 031                writer.WriteBooleanValue(NegationConditon.Value);
 32            }
 033            writer.WritePropertyName("matchValues");
 034            writer.WriteStartArray();
 035            foreach (var item in MatchValues)
 36            {
 037                writer.WriteStringValue(item);
 38            }
 039            writer.WriteEndArray();
 040            if (Transforms != null)
 41            {
 042                writer.WritePropertyName("transforms");
 043                writer.WriteStartArray();
 044                foreach (var item in Transforms)
 45                {
 046                    writer.WriteStringValue(item.ToString());
 47                }
 048                writer.WriteEndArray();
 49            }
 050            writer.WriteEndObject();
 051        }
 52
 53        internal static MatchCondition DeserializeMatchCondition(JsonElement element)
 54        {
 055            IList<MatchVariable> matchVariables = default;
 056            WebApplicationFirewallOperator @operator = default;
 057            bool? negationConditon = default;
 058            IList<string> matchValues = default;
 059            IList<WebApplicationFirewallTransform> transforms = default;
 060            foreach (var property in element.EnumerateObject())
 61            {
 062                if (property.NameEquals("matchVariables"))
 63                {
 064                    List<MatchVariable> array = new List<MatchVariable>();
 065                    foreach (var item in property.Value.EnumerateArray())
 66                    {
 067                        if (item.ValueKind == JsonValueKind.Null)
 68                        {
 069                            array.Add(null);
 70                        }
 71                        else
 72                        {
 073                            array.Add(MatchVariable.DeserializeMatchVariable(item));
 74                        }
 75                    }
 076                    matchVariables = array;
 077                    continue;
 78                }
 079                if (property.NameEquals("operator"))
 80                {
 081                    @operator = new WebApplicationFirewallOperator(property.Value.GetString());
 082                    continue;
 83                }
 084                if (property.NameEquals("negationConditon"))
 85                {
 086                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 090                    negationConditon = property.Value.GetBoolean();
 091                    continue;
 92                }
 093                if (property.NameEquals("matchValues"))
 94                {
 095                    List<string> array = new List<string>();
 096                    foreach (var item in property.Value.EnumerateArray())
 97                    {
 098                        if (item.ValueKind == JsonValueKind.Null)
 99                        {
 0100                            array.Add(null);
 101                        }
 102                        else
 103                        {
 0104                            array.Add(item.GetString());
 105                        }
 106                    }
 0107                    matchValues = array;
 0108                    continue;
 109                }
 0110                if (property.NameEquals("transforms"))
 111                {
 0112                    if (property.Value.ValueKind == JsonValueKind.Null)
 113                    {
 114                        continue;
 115                    }
 0116                    List<WebApplicationFirewallTransform> array = new List<WebApplicationFirewallTransform>();
 0117                    foreach (var item in property.Value.EnumerateArray())
 118                    {
 0119                        array.Add(new WebApplicationFirewallTransform(item.GetString()));
 120                    }
 0121                    transforms = array;
 122                    continue;
 123                }
 124            }
 0125            return new MatchCondition(matchVariables, @operator, negationConditon, matchValues, transforms);
 126        }
 127    }
 128}