< Summary

Class:Azure.ResourceManager.Storage.Models.UsageUnitExtensions
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\UsageUnit.Serialization.cs
Covered lines:1
Uncovered lines:16
Coverable lines:17
Total lines:36
Line coverage:5.8% (1 of 17)
Covered branches:1
Total branches:19
Branch coverage:5.2% (1 of 19)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerialString(...)-0%0%
ToUsageUnit(...)-14.29%8.33%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\UsageUnit.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;
 9
 10namespace Azure.ResourceManager.Storage.Models
 11{
 12    internal static class UsageUnitExtensions
 13    {
 014        public static string ToSerialString(this UsageUnit value) => value switch
 015        {
 016            UsageUnit.Count => "Count",
 017            UsageUnit.Bytes => "Bytes",
 018            UsageUnit.Seconds => "Seconds",
 019            UsageUnit.Percent => "Percent",
 020            UsageUnit.CountsPerSecond => "CountsPerSecond",
 021            UsageUnit.BytesPerSecond => "BytesPerSecond",
 022            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UsageUnit value.")
 023        };
 24
 25        public static UsageUnit ToUsageUnit(this string value)
 26        {
 827            if (string.Equals(value, "Count", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Count;
 028            if (string.Equals(value, "Bytes", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Bytes;
 029            if (string.Equals(value, "Seconds", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Seconds;
 030            if (string.Equals(value, "Percent", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Percent;
 031            if (string.Equals(value, "CountsPerSecond", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.C
 032            if (string.Equals(value, "BytesPerSecond", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.By
 033            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UsageUnit value.");
 34        }
 35    }
 36}