< Summary

Class:Azure.ResourceManager.Compute.Models.ResourceSkuRestrictions
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ResourceSkuRestrictions.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ResourceSkuRestrictions.Serialization.cs
Covered lines:31
Uncovered lines:7
Coverable lines:38
Total lines:118
Line coverage:81.5% (31 of 38)
Covered branches:21
Total branches:22
Branch coverage:95.4% (21 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Type()-0%100%
get_Values()-0%100%
get_RestrictionInfo()-0%100%
get_ReasonCode()-0%100%
DeserializeResourceSkuRestrictions(...)-96.15%95.45%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ResourceSkuRestrictions.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.Compute.Models
 11{
 12    /// <summary> Describes scaling information of a SKU. </summary>
 13    public partial class ResourceSkuRestrictions
 14    {
 15        /// <summary> Initializes a new instance of ResourceSkuRestrictions. </summary>
 016        internal ResourceSkuRestrictions()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ResourceSkuRestrictions. </summary>
 21        /// <param name="type"> The type of restrictions. </param>
 22        /// <param name="values"> The value of restrictions. If the restriction type is set to location. This would be d
 23        /// <param name="restrictionInfo"> The information about the restriction where the SKU cannot be used. </param>
 24        /// <param name="reasonCode"> The reason for restriction. </param>
 1521225        internal ResourceSkuRestrictions(ResourceSkuRestrictionsType? type, IReadOnlyList<string> values, ResourceSkuRes
 26        {
 1521227            Type = type;
 1521228            Values = values;
 1521229            RestrictionInfo = restrictionInfo;
 1521230            ReasonCode = reasonCode;
 1521231        }
 32
 33        /// <summary> The type of restrictions. </summary>
 034        public ResourceSkuRestrictionsType? Type { get; }
 35        /// <summary> The value of restrictions. If the restriction type is set to location. This would be different loc
 036        public IReadOnlyList<string> Values { get; }
 37        /// <summary> The information about the restriction where the SKU cannot be used. </summary>
 038        public ResourceSkuRestrictionInfo RestrictionInfo { get; }
 39        /// <summary> The reason for restriction. </summary>
 040        public ResourceSkuRestrictionsReasonCode? ReasonCode { get; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ResourceSkuRestrictions.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.Compute.Models
 13{
 14    public partial class ResourceSkuRestrictions
 15    {
 16        internal static ResourceSkuRestrictions DeserializeResourceSkuRestrictions(JsonElement element)
 17        {
 1521218            ResourceSkuRestrictionsType? type = default;
 1521219            IReadOnlyList<string> values = default;
 1521220            ResourceSkuRestrictionInfo restrictionInfo = default;
 1521221            ResourceSkuRestrictionsReasonCode? reasonCode = default;
 15212022            foreach (var property in element.EnumerateObject())
 23            {
 6084824                if (property.NameEquals("type"))
 25                {
 1521226                    if (property.Value.ValueKind == JsonValueKind.Null)
 27                    {
 28                        continue;
 29                    }
 1521230                    type = property.Value.GetString().ToResourceSkuRestrictionsType();
 1521231                    continue;
 32                }
 4563633                if (property.NameEquals("values"))
 34                {
 1521235                    if (property.Value.ValueKind == JsonValueKind.Null)
 36                    {
 37                        continue;
 38                    }
 1521239                    List<string> array = new List<string>();
 6084840                    foreach (var item in property.Value.EnumerateArray())
 41                    {
 1521242                        if (item.ValueKind == JsonValueKind.Null)
 43                        {
 044                            array.Add(null);
 45                        }
 46                        else
 47                        {
 1521248                            array.Add(item.GetString());
 49                        }
 50                    }
 1521251                    values = array;
 1521252                    continue;
 53                }
 3042454                if (property.NameEquals("restrictionInfo"))
 55                {
 1521256                    if (property.Value.ValueKind == JsonValueKind.Null)
 57                    {
 58                        continue;
 59                    }
 1521260                    restrictionInfo = ResourceSkuRestrictionInfo.DeserializeResourceSkuRestrictionInfo(property.Value);
 1521261                    continue;
 62                }
 1521263                if (property.NameEquals("reasonCode"))
 64                {
 1521265                    if (property.Value.ValueKind == JsonValueKind.Null)
 66                    {
 67                        continue;
 68                    }
 1521269                    reasonCode = property.Value.GetString().ToResourceSkuRestrictionsReasonCode();
 70                    continue;
 71                }
 72            }
 1521273            return new ResourceSkuRestrictions(type, values, restrictionInfo, reasonCode);
 74        }
 75    }
 76}