< Summary

Class:Azure.ResourceManager.Resources.Models.Subscription
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Subscription.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Subscription.Serialization.cs
Covered lines:68
Uncovered lines:10
Coverable lines:78
Total lines:200
Line coverage:87.1% (68 of 78)
Covered branches:42
Total branches:46
Branch coverage:91.3% (42 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_SubscriptionId()-100%100%
get_DisplayName()-100%100%
get_TenantId()-0%100%
get_State()-100%100%
get_SubscriptionPolicies()-100%100%
get_AuthorizationSource()-0%100%
get_ManagedByTenants()-0%100%
get_Tags()-100%100%
DeserializeSubscription(...)-91.07%91.3%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Subscription.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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> Subscription information. </summary>
 13    public partial class Subscription
 14    {
 15        /// <summary> Initializes a new instance of Subscription. </summary>
 016        internal Subscription()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of Subscription. </summary>
 21        /// <param name="id"> The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-000
 22        /// <param name="subscriptionId"> The subscription ID. </param>
 23        /// <param name="displayName"> The subscription display name. </param>
 24        /// <param name="tenantId"> The subscription tenant ID. </param>
 25        /// <param name="state"> The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Del
 26        /// <param name="subscriptionPolicies"> The subscription policies. </param>
 27        /// <param name="authorizationSource"> The authorization source of the request. Valid values are one or more com
 28        /// <param name="managedByTenants"> An array containing the tenants managing the subscription. </param>
 29        /// <param name="tags"> The tags attached to the subscription. </param>
 2430        internal Subscription(string id, string subscriptionId, string displayName, string tenantId, SubscriptionState? 
 31        {
 2432            Id = id;
 2433            SubscriptionId = subscriptionId;
 2434            DisplayName = displayName;
 2435            TenantId = tenantId;
 2436            State = state;
 2437            SubscriptionPolicies = subscriptionPolicies;
 2438            AuthorizationSource = authorizationSource;
 2439            ManagedByTenants = managedByTenants;
 2440            Tags = tags;
 2441        }
 42
 43        /// <summary> The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-0
 1644        public string Id { get; }
 45        /// <summary> The subscription ID. </summary>
 1646        public string SubscriptionId { get; }
 47        /// <summary> The subscription display name. </summary>
 1648        public string DisplayName { get; }
 49        /// <summary> The subscription tenant ID. </summary>
 050        public string TenantId { get; }
 51        /// <summary> The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. </sum
 1652        public SubscriptionState? State { get; }
 53        /// <summary> The subscription policies. </summary>
 2454        public SubscriptionPolicies SubscriptionPolicies { get; }
 55        /// <summary> The authorization source of the request. Valid values are one or more combinations of Legacy, Role
 056        public string AuthorizationSource { get; }
 57        /// <summary> An array containing the tenants managing the subscription. </summary>
 058        public IReadOnlyList<ManagedByTenant> ManagedByTenants { get; }
 59        /// <summary> The tags attached to the subscription. </summary>
 1660        public IReadOnlyDictionary<string, string> Tags { get; }
 61    }
 62}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Subscription.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Resources.Models
 13{
 14    public partial class Subscription
 15    {
 16        internal static Subscription DeserializeSubscription(JsonElement element)
 17        {
 2418            string id = default;
 2419            string subscriptionId = default;
 2420            string displayName = default;
 2421            string tenantId = default;
 2422            SubscriptionState? state = default;
 2423            SubscriptionPolicies subscriptionPolicies = default;
 2424            string authorizationSource = default;
 2425            IReadOnlyList<ManagedByTenant> managedByTenants = default;
 2426            IReadOnlyDictionary<string, string> tags = default;
 36027            foreach (var property in element.EnumerateObject())
 28            {
 15629                if (property.NameEquals("id"))
 30                {
 2431                    if (property.Value.ValueKind == JsonValueKind.Null)
 32                    {
 33                        continue;
 34                    }
 2435                    id = property.Value.GetString();
 2436                    continue;
 37                }
 13238                if (property.NameEquals("subscriptionId"))
 39                {
 2440                    if (property.Value.ValueKind == JsonValueKind.Null)
 41                    {
 42                        continue;
 43                    }
 2444                    subscriptionId = property.Value.GetString();
 2445                    continue;
 46                }
 10847                if (property.NameEquals("displayName"))
 48                {
 2449                    if (property.Value.ValueKind == JsonValueKind.Null)
 50                    {
 51                        continue;
 52                    }
 2453                    displayName = property.Value.GetString();
 2454                    continue;
 55                }
 8456                if (property.NameEquals("tenantId"))
 57                {
 858                    if (property.Value.ValueKind == JsonValueKind.Null)
 59                    {
 60                        continue;
 61                    }
 862                    tenantId = property.Value.GetString();
 863                    continue;
 64                }
 7665                if (property.NameEquals("state"))
 66                {
 2467                    if (property.Value.ValueKind == JsonValueKind.Null)
 68                    {
 69                        continue;
 70                    }
 2471                    state = property.Value.GetString().ToSubscriptionState();
 2472                    continue;
 73                }
 5274                if (property.NameEquals("subscriptionPolicies"))
 75                {
 2476                    if (property.Value.ValueKind == JsonValueKind.Null)
 77                    {
 78                        continue;
 79                    }
 2480                    subscriptionPolicies = SubscriptionPolicies.DeserializeSubscriptionPolicies(property.Value);
 2481                    continue;
 82                }
 2883                if (property.NameEquals("authorizationSource"))
 84                {
 885                    if (property.Value.ValueKind == JsonValueKind.Null)
 86                    {
 87                        continue;
 88                    }
 889                    authorizationSource = property.Value.GetString();
 890                    continue;
 91                }
 2092                if (property.NameEquals("managedByTenants"))
 93                {
 894                    if (property.Value.ValueKind == JsonValueKind.Null)
 95                    {
 96                        continue;
 97                    }
 898                    List<ManagedByTenant> array = new List<ManagedByTenant>();
 099                    foreach (var item in property.Value.EnumerateArray())
 100                    {
 0101                        if (item.ValueKind == JsonValueKind.Null)
 102                        {
 0103                            array.Add(null);
 104                        }
 105                        else
 106                        {
 0107                            array.Add(ManagedByTenant.DeserializeManagedByTenant(item));
 108                        }
 109                    }
 8110                    managedByTenants = array;
 8111                    continue;
 112                }
 12113                if (property.NameEquals("tags"))
 114                {
 12115                    if (property.Value.ValueKind == JsonValueKind.Null)
 116                    {
 117                        continue;
 118                    }
 12119                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 64120                    foreach (var property0 in property.Value.EnumerateObject())
 121                    {
 20122                        if (property0.Value.ValueKind == JsonValueKind.Null)
 123                        {
 0124                            dictionary.Add(property0.Name, null);
 125                        }
 126                        else
 127                        {
 20128                            dictionary.Add(property0.Name, property0.Value.GetString());
 129                        }
 130                    }
 12131                    tags = dictionary;
 132                    continue;
 133                }
 134            }
 24135            return new Subscription(id, subscriptionId, displayName, tenantId, state, subscriptionPolicies, authorizatio
 136        }
 137    }
 138}