< Summary

Class:Azure.ResourceManager.Resources.Models.ResourceGroup
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceGroup.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceGroup.Serialization.cs
Covered lines:76
Uncovered lines:12
Coverable lines:88
Total lines:208
Line coverage:86.3% (76 of 88)
Covered branches:41
Total branches:48
Branch coverage:85.4% (41 of 48)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-100%100%
get_Type()-100%100%
get_Properties()-100%100%
get_Location()-100%100%
get_ManagedBy()-100%100%
get_Tags()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-62.96%64.29%
DeserializeResourceGroup(...)-97.5%96.88%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceGroup.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Resources.Models
 12{
 13    /// <summary> Resource group information. </summary>
 14    public partial class ResourceGroup
 15    {
 16        /// <summary> Initializes a new instance of ResourceGroup. </summary>
 17        /// <param name="location"> The location of the resource group. It cannot be changed after the resource group ha
 9018        public ResourceGroup(string location)
 19        {
 9020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 24
 9025            Location = location;
 9026        }
 27
 28        /// <summary> Initializes a new instance of ResourceGroup. </summary>
 29        /// <param name="id"> The ID of the resource group. </param>
 30        /// <param name="name"> The name of the resource group. </param>
 31        /// <param name="type"> The type of the resource group. </param>
 32        /// <param name="properties"> The resource group properties. </param>
 33        /// <param name="location"> The location of the resource group. It cannot be changed after the resource group ha
 34        /// <param name="managedBy"> The ID of the resource that manages this resource group. </param>
 35        /// <param name="tags"> The tags attached to the resource group. </param>
 51236        internal ResourceGroup(string id, string name, string type, ResourceGroupProperties properties, string location,
 37        {
 51238            Id = id;
 51239            Name = name;
 51240            Type = type;
 51241            Properties = properties;
 51242            Location = location;
 51243            ManagedBy = managedBy;
 51244            Tags = tags;
 51245        }
 46
 47        /// <summary> The ID of the resource group. </summary>
 13248        public string Id { get; }
 49        /// <summary> The name of the resource group. </summary>
 36050        public string Name { get; }
 51        /// <summary> The type of the resource group. </summary>
 11252        public string Type { get; }
 53        /// <summary> The resource group properties. </summary>
 64454        public ResourceGroupProperties Properties { get; set; }
 55        /// <summary> The location of the resource group. It cannot be changed after the resource group has been created
 74656        public string Location { get; set; }
 57        /// <summary> The ID of the resource that manages this resource group. </summary>
 62458        public string ManagedBy { get; set; }
 59        /// <summary> The tags attached to the resource group. </summary>
 65660        public IDictionary<string, string> Tags { get; set; }
 61    }
 62}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceGroup.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 ResourceGroup : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 11218            writer.WriteStartObject();
 11219            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 11224            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 11229            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 11234            if (Properties != null)
 35            {
 036                writer.WritePropertyName("properties");
 037                writer.WriteObjectValue(Properties);
 38            }
 11239            writer.WritePropertyName("location");
 11240            writer.WriteStringValue(Location);
 11241            if (ManagedBy != null)
 42            {
 043                writer.WritePropertyName("managedBy");
 044                writer.WriteStringValue(ManagedBy);
 45            }
 11246            if (Tags != null)
 47            {
 848                writer.WritePropertyName("tags");
 849                writer.WriteStartObject();
 4850                foreach (var item in Tags)
 51                {
 1652                    writer.WritePropertyName(item.Key);
 1653                    writer.WriteStringValue(item.Value);
 54                }
 855                writer.WriteEndObject();
 56            }
 11257            writer.WriteEndObject();
 11258        }
 59
 60        internal static ResourceGroup DeserializeResourceGroup(JsonElement element)
 61        {
 51262            string id = default;
 51263            string name = default;
 51264            string type = default;
 51265            ResourceGroupProperties properties = default;
 51266            string location = default;
 51267            string managedBy = default;
 51268            IDictionary<string, string> tags = default;
 645669            foreach (var property in element.EnumerateObject())
 70            {
 271671                if (property.NameEquals("id"))
 72                {
 50473                    if (property.Value.ValueKind == JsonValueKind.Null)
 74                    {
 75                        continue;
 76                    }
 50477                    id = property.Value.GetString();
 50478                    continue;
 79                }
 221280                if (property.NameEquals("name"))
 81                {
 51282                    if (property.Value.ValueKind == JsonValueKind.Null)
 83                    {
 84                        continue;
 85                    }
 51286                    name = property.Value.GetString();
 51287                    continue;
 88                }
 170089                if (property.NameEquals("type"))
 90                {
 48091                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 48095                    type = property.Value.GetString();
 48096                    continue;
 97                }
 122098                if (property.NameEquals("properties"))
 99                {
 504100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 504104                    properties = ResourceGroupProperties.DeserializeResourceGroupProperties(property.Value);
 504105                    continue;
 106                }
 716107                if (property.NameEquals("location"))
 108                {
 512109                    location = property.Value.GetString();
 512110                    continue;
 111                }
 204112                if (property.NameEquals("managedBy"))
 113                {
 24114                    if (property.Value.ValueKind == JsonValueKind.Null)
 115                    {
 116                        continue;
 117                    }
 24118                    managedBy = property.Value.GetString();
 24119                    continue;
 120                }
 180121                if (property.NameEquals("tags"))
 122                {
 168123                    if (property.Value.ValueKind == JsonValueKind.Null)
 124                    {
 125                        continue;
 126                    }
 168127                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 1168128                    foreach (var property0 in property.Value.EnumerateObject())
 129                    {
 416130                        if (property0.Value.ValueKind == JsonValueKind.Null)
 131                        {
 0132                            dictionary.Add(property0.Name, null);
 133                        }
 134                        else
 135                        {
 416136                            dictionary.Add(property0.Name, property0.Value.GetString());
 137                        }
 138                    }
 168139                    tags = dictionary;
 140                    continue;
 141                }
 142            }
 512143            return new ResourceGroup(id, name, type, properties, location, managedBy, tags);
 144        }
 145    }
 146}