< Summary

Class:Azure.ResourceManager.Resources.Models.SubscriptionStateExtensions
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\SubscriptionState.Serialization.cs
Covered lines:2
Uncovered lines:13
Coverable lines:15
Total lines:34
Line coverage:13.3% (2 of 15)
Covered branches:5
Total branches:16
Branch coverage:31.2% (5 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerialString(...)-0%0%
ToSubscriptionState(...)-33.33%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\SubscriptionState.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.Resources.Models
 11{
 12    internal static class SubscriptionStateExtensions
 13    {
 014        public static string ToSerialString(this SubscriptionState value) => value switch
 015        {
 016            SubscriptionState.Enabled => "Enabled",
 017            SubscriptionState.Warned => "Warned",
 018            SubscriptionState.PastDue => "PastDue",
 019            SubscriptionState.Disabled => "Disabled",
 020            SubscriptionState.Deleted => "Deleted",
 021            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SubscriptionState value.")
 022        };
 23
 24        public static SubscriptionState ToSubscriptionState(this string value)
 25        {
 4026            if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.E
 027            if (string.Equals(value, "Warned", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.Wa
 028            if (string.Equals(value, "PastDue", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.P
 1629            if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.
 030            if (string.Equals(value, "Deleted", StringComparison.InvariantCultureIgnoreCase)) return SubscriptionState.D
 031            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SubscriptionState value.");
 32        }
 33    }
 34}