< Summary

Class:Azure.ResourceManager.Network.Models.Usage
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Usage.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Usage.Serialization.cs
Covered lines:31
Uncovered lines:11
Coverable lines:42
Total lines:115
Line coverage:73.8% (31 of 42)
Covered branches:14
Total branches:16
Branch coverage:87.5% (14 of 16)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\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.Network.Models
 11{
 12    /// <summary> The network resource usage. </summary>
 13    public partial class Usage
 14    {
 15        /// <summary> Initializes a new instance of Usage. </summary>
 16        /// <param name="currentValue"> The current value of the usage. </param>
 17        /// <param name="limit"> The limit of usage. </param>
 18        /// <param name="name"> The name of the type of usage. </param>
 019        internal Usage(long 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="id"> Resource identifier. </param>
 34        /// <param name="unit"> An enum describing the unit of measurement. </param>
 35        /// <param name="currentValue"> The current value of the usage. </param>
 36        /// <param name="limit"> The limit of usage. </param>
 37        /// <param name="name"> The name of the type of usage. </param>
 16838        internal Usage(string id, string unit, long currentValue, long limit, UsageName name)
 39        {
 16840            Id = id;
 16841            Unit = unit;
 16842            CurrentValue = currentValue;
 16843            Limit = limit;
 16844            Name = name;
 16845        }
 46
 47        /// <summary> Resource identifier. </summary>
 048        public string Id { get; }
 49        /// <summary> An enum describing the unit of measurement. </summary>
 050        public string Unit { get; }
 51        /// <summary> The current value of the usage. </summary>
 052        public long CurrentValue { get; }
 53        /// <summary> The limit of usage. </summary>
 16854        public long Limit { get; }
 55        /// <summary> The name of the type of usage. </summary>
 50456        public UsageName Name { get; }
 57    }
 58}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\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.Network.Models
 12{
 13    public partial class Usage
 14    {
 15        internal static Usage DeserializeUsage(JsonElement element)
 16        {
 16817            string id = default;
 16818            string unit = default;
 16819            long currentValue = default;
 16820            long limit = default;
 16821            UsageName name = default;
 201622            foreach (var property in element.EnumerateObject())
 23            {
 84024                if (property.NameEquals("id"))
 25                {
 16826                    if (property.Value.ValueKind == JsonValueKind.Null)
 27                    {
 28                        continue;
 29                    }
 16830                    id = property.Value.GetString();
 16831                    continue;
 32                }
 67233                if (property.NameEquals("unit"))
 34                {
 16835                    unit = property.Value.GetString();
 16836                    continue;
 37                }
 50438                if (property.NameEquals("currentValue"))
 39                {
 16840                    currentValue = property.Value.GetInt64();
 16841                    continue;
 42                }
 33643                if (property.NameEquals("limit"))
 44                {
 16845                    limit = property.Value.GetInt64();
 16846                    continue;
 47                }
 16848                if (property.NameEquals("name"))
 49                {
 16850                    name = UsageName.DeserializeUsageName(property.Value);
 51                    continue;
 52                }
 53            }
 16854            return new Usage(id, unit, currentValue, limit, name);
 55        }
 56    }
 57}