< Summary

Class:Azure.ResourceManager.Storage.Models.Usage
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Usage.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Usage.Serialization.cs
Covered lines:31
Uncovered lines:2
Coverable lines:33
Total lines:103
Line coverage:93.9% (31 of 33)
Covered branches:18
Total branches:18
Branch coverage:100% (18 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Unit()-100%100%
get_CurrentValue()-100%100%
get_Limit()-100%100%
get_Name()-100%100%
DeserializeUsage(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Usage.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.Storage.Models
 9{
 10    /// <summary> Describes Storage Resource Usage. </summary>
 11    public partial class Usage
 12    {
 13        /// <summary> Initializes a new instance of Usage. </summary>
 014        internal Usage()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of Usage. </summary>
 19        /// <param name="unit"> Gets the unit of measurement. </param>
 20        /// <param name="currentValue"> Gets the current count of the allocated resources in the subscription. </param>
 21        /// <param name="limit"> Gets the maximum count of the resources that can be allocated in the subscription. </pa
 22        /// <param name="name"> Gets the name of the type of usage. </param>
 423        internal Usage(UsageUnit? unit, int? currentValue, int? limit, UsageName name)
 24        {
 425            Unit = unit;
 426            CurrentValue = currentValue;
 427            Limit = limit;
 428            Name = name;
 429        }
 30
 31        /// <summary> Gets the unit of measurement. </summary>
 432        public UsageUnit? Unit { get; }
 33        /// <summary> Gets the current count of the allocated resources in the subscription. </summary>
 434        public int? CurrentValue { get; }
 35        /// <summary> Gets the maximum count of the resources that can be allocated in the subscription. </summary>
 436        public int? Limit { get; }
 37        /// <summary> Gets the name of the type of usage. </summary>
 1238        public UsageName Name { get; }
 39    }
 40}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\Usage.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.Storage.Models
 12{
 13    public partial class Usage
 14    {
 15        internal static Usage DeserializeUsage(JsonElement element)
 16        {
 417            UsageUnit? unit = default;
 418            int? currentValue = default;
 419            int? limit = default;
 420            UsageName name = default;
 4021            foreach (var property in element.EnumerateObject())
 22            {
 1623                if (property.NameEquals("unit"))
 24                {
 425                    if (property.Value.ValueKind == JsonValueKind.Null)
 26                    {
 27                        continue;
 28                    }
 429                    unit = property.Value.GetString().ToUsageUnit();
 430                    continue;
 31                }
 1232                if (property.NameEquals("currentValue"))
 33                {
 434                    if (property.Value.ValueKind == JsonValueKind.Null)
 35                    {
 36                        continue;
 37                    }
 438                    currentValue = property.Value.GetInt32();
 439                    continue;
 40                }
 841                if (property.NameEquals("limit"))
 42                {
 443                    if (property.Value.ValueKind == JsonValueKind.Null)
 44                    {
 45                        continue;
 46                    }
 447                    limit = property.Value.GetInt32();
 448                    continue;
 49                }
 450                if (property.NameEquals("name"))
 51                {
 452                    if (property.Value.ValueKind == JsonValueKind.Null)
 53                    {
 54                        continue;
 55                    }
 456                    name = UsageName.DeserializeUsageName(property.Value);
 57                    continue;
 58                }
 59            }
 460            return new Usage(unit, currentValue, limit, name);
 61        }
 62    }
 63}