< Summary

Class:Azure.ResourceManager.Resources.Models.ParameterDefinitionsValue
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ParameterDefinitionsValue.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ParameterDefinitionsValue.Serialization.cs
Covered lines:46
Uncovered lines:10
Coverable lines:56
Total lines:149
Line coverage:82.1% (46 of 56)
Covered branches:26
Total branches:32
Branch coverage:81.2% (26 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Type()-100%100%
get_AllowedValues()-100%100%
get_DefaultValue()-100%100%
get_Metadata()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-50%50%
DeserializeParameterDefinitionsValue(...)-96.15%95.45%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ParameterDefinitionsValue.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;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> The definition of a parameter that can be provided to the policy. </summary>
 13    public partial class ParameterDefinitionsValue
 14    {
 15        /// <summary> Initializes a new instance of ParameterDefinitionsValue. </summary>
 616        public ParameterDefinitionsValue()
 17        {
 618        }
 19
 20        /// <summary> Initializes a new instance of ParameterDefinitionsValue. </summary>
 21        /// <param name="type"> The data type of the parameter. </param>
 22        /// <param name="allowedValues"> The allowed values for the parameter. </param>
 23        /// <param name="defaultValue"> The default value for the parameter if no value is provided. </param>
 24        /// <param name="metadata"> General metadata for the parameter. </param>
 6403625        internal ParameterDefinitionsValue(ParameterType? type, IList<object> allowedValues, object defaultValue, Parame
 26        {
 6403627            Type = type;
 6403628            AllowedValues = allowedValues;
 6403629            DefaultValue = defaultValue;
 6403630            Metadata = metadata;
 6403631        }
 32
 33        /// <summary> The data type of the parameter. </summary>
 6408234        public ParameterType? Type { get; set; }
 35        /// <summary> The allowed values for the parameter. </summary>
 6405636        public IList<object> AllowedValues { get; set; }
 37        /// <summary> The default value for the parameter if no value is provided. </summary>
 6405638        public object DefaultValue { get; set; }
 39        /// <summary> General metadata for the parameter. </summary>
 6405640        public ParameterDefinitionsValueMetadata Metadata { get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ParameterDefinitionsValue.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.Resources.Models
 13{
 14    public partial class ParameterDefinitionsValue : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 2018            writer.WriteStartObject();
 2019            if (Type != null)
 20            {
 2021                writer.WritePropertyName("type");
 2022                writer.WriteStringValue(Type.Value.ToString());
 23            }
 2024            if (AllowedValues != null)
 25            {
 026                writer.WritePropertyName("allowedValues");
 027                writer.WriteStartArray();
 028                foreach (var item in AllowedValues)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 2034            if (DefaultValue != null)
 35            {
 036                writer.WritePropertyName("defaultValue");
 037                writer.WriteObjectValue(DefaultValue);
 38            }
 2039            if (Metadata != null)
 40            {
 041                writer.WritePropertyName("metadata");
 042                writer.WriteObjectValue(Metadata);
 43            }
 2044            writer.WriteEndObject();
 2045        }
 46
 47        internal static ParameterDefinitionsValue DeserializeParameterDefinitionsValue(JsonElement element)
 48        {
 6403649            ParameterType? type = default;
 6403650            IList<object> allowedValues = default;
 6403651            object defaultValue = default;
 6403652            ParameterDefinitionsValueMetadata metadata = default;
 56140853            foreach (var property in element.EnumerateObject())
 54            {
 21666855                if (property.NameEquals("type"))
 56                {
 6403657                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 6403661                    type = new ParameterType(property.Value.GetString());
 6403662                    continue;
 63                }
 15263264                if (property.NameEquals("allowedValues"))
 65                {
 3507266                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 3507270                    List<object> array = new List<object>();
 29774471                    foreach (var item in property.Value.EnumerateArray())
 72                    {
 11380073                        if (item.ValueKind == JsonValueKind.Null)
 74                        {
 075                            array.Add(null);
 76                        }
 77                        else
 78                        {
 11380079                            array.Add(item.GetObject());
 80                        }
 81                    }
 3507282                    allowedValues = array;
 3507283                    continue;
 84                }
 11756085                if (property.NameEquals("defaultValue"))
 86                {
 5354487                    if (property.Value.ValueKind == JsonValueKind.Null)
 88                    {
 89                        continue;
 90                    }
 5354491                    defaultValue = property.Value.GetObject();
 5354492                    continue;
 93                }
 6401694                if (property.NameEquals("metadata"))
 95                {
 6401696                    if (property.Value.ValueKind == JsonValueKind.Null)
 97                    {
 98                        continue;
 99                    }
 64016100                    metadata = ParameterDefinitionsValueMetadata.DeserializeParameterDefinitionsValueMetadata(property.V
 101                    continue;
 102                }
 103            }
 64036104            return new ParameterDefinitionsValue(type, allowedValues, defaultValue, metadata);
 105        }
 106    }
 107}