< Summary

Class:Azure.ResourceManager.Compute.Models.Usage
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Usage.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Usage.Serialization.cs
Covered lines:24
Uncovered lines:11
Coverable lines:35
Total lines:101
Line coverage:68.5% (24 of 35)
Covered branches:10
Total branches:12
Branch coverage:83.3% (10 of 12)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\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
 8using System;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> Describes Compute Resource Usage. </summary>
 13    public partial class Usage
 14    {
 15        /// <summary> Initializes a new instance of Usage. </summary>
 16        /// <param name="currentValue"> The current usage of the resource. </param>
 17        /// <param name="limit"> The maximum permitted usage of the resource. </param>
 18        /// <param name="name"> The name of the type of usage. </param>
 019        internal Usage(int currentValue, long limit, UsageName name)
 20        {
 021            if (name == null)
 22            {
 023                throw new ArgumentNullException(nameof(name));
 24            }
 25
 026            Unit = "Count";
 027            CurrentValue = currentValue;
 028            Limit = limit;
 029            Name = name;
 030        }
 31
 32        /// <summary> Initializes a new instance of Usage. </summary>
 33        /// <param name="unit"> An enum describing the unit of usage measurement. </param>
 34        /// <param name="currentValue"> The current usage of the resource. </param>
 35        /// <param name="limit"> The maximum permitted usage of the resource. </param>
 36        /// <param name="name"> The name of the type of usage. </param>
 28837        internal Usage(string unit, int currentValue, long limit, UsageName name)
 38        {
 28839            Unit = unit;
 28840            CurrentValue = currentValue;
 28841            Limit = limit;
 28842            Name = name;
 28843        }
 44
 45        /// <summary> An enum describing the unit of usage measurement. </summary>
 046        public string Unit { get; }
 47        /// <summary> The current usage of the resource. </summary>
 048        public int CurrentValue { get; }
 49        /// <summary> The maximum permitted usage of the resource. </summary>
 050        public long Limit { get; }
 51        /// <summary> The name of the type of usage. </summary>
 57652        public UsageName Name { get; }
 53    }
 54}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\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.Compute.Models
 12{
 13    public partial class Usage
 14    {
 15        internal static Usage DeserializeUsage(JsonElement element)
 16        {
 28817            string unit = default;
 28818            int currentValue = default;
 28819            long limit = default;
 28820            UsageName name = default;
 288021            foreach (var property in element.EnumerateObject())
 22            {
 115223                if (property.NameEquals("unit"))
 24                {
 28825                    unit = property.Value.GetString();
 28826                    continue;
 27                }
 86428                if (property.NameEquals("currentValue"))
 29                {
 28830                    currentValue = property.Value.GetInt32();
 28831                    continue;
 32                }
 57633                if (property.NameEquals("limit"))
 34                {
 28835                    limit = property.Value.GetInt64();
 28836                    continue;
 37                }
 28838                if (property.NameEquals("name"))
 39                {
 28840                    name = UsageName.DeserializeUsageName(property.Value);
 41                    continue;
 42                }
 43            }
 28844            return new Usage(unit, currentValue, limit, name);
 45        }
 46    }
 47}