< Summary

Class:Azure.ResourceManager.Resources.Models.PolicyDefinitionGroup
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicyDefinitionGroup.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicyDefinitionGroup.Serialization.cs
Covered lines:41
Uncovered lines:18
Coverable lines:59
Total lines:150
Line coverage:69.4% (41 of 59)
Covered branches:19
Total branches:30
Branch coverage:63.3% (19 of 30)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Name()-100%100%
get_DisplayName()-100%100%
get_Category()-100%100%
get_Description()-100%100%
get_AdditionalMetadataId()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-52.94%50%
DeserializePolicyDefinitionGroup(...)-64%70%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicyDefinitionGroup.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    /// <summary> The policy definition group. </summary>
 13    public partial class PolicyDefinitionGroup
 14    {
 15        /// <summary> Initializes a new instance of PolicyDefinitionGroup. </summary>
 16        /// <param name="name"> The name of the group. </param>
 817        public PolicyDefinitionGroup(string name)
 18        {
 819            if (name == null)
 20            {
 021                throw new ArgumentNullException(nameof(name));
 22            }
 23
 824            Name = name;
 825        }
 26
 27        /// <summary> Initializes a new instance of PolicyDefinitionGroup. </summary>
 28        /// <param name="name"> The name of the group. </param>
 29        /// <param name="displayName"> The group&apos;s display name. </param>
 30        /// <param name="category"> The group&apos;s category. </param>
 31        /// <param name="description"> The group&apos;s description. </param>
 32        /// <param name="additionalMetadataId"> A resource ID of a resource that contains additional metadata about the 
 1739233        internal PolicyDefinitionGroup(string name, string displayName, string category, string description, string addi
 34        {
 1739235            Name = name;
 1739236            DisplayName = displayName;
 1739237            Category = category;
 1739238            Description = description;
 1739239            AdditionalMetadataId = additionalMetadataId;
 1739240        }
 41
 42        /// <summary> The name of the group. </summary>
 150506443        public string Name { get; set; }
 44        /// <summary> The group&apos;s display name. </summary>
 1740045        public string DisplayName { get; set; }
 46        /// <summary> The group&apos;s category. </summary>
 1740047        public string Category { get; set; }
 48        /// <summary> The group&apos;s description. </summary>
 1740049        public string Description { get; set; }
 50        /// <summary> A resource ID of a resource that contains additional metadata about the group. </summary>
 1740051        public string AdditionalMetadataId { get; set; }
 52    }
 53}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicyDefinitionGroup.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.Resources.Models
 12{
 13    public partial class PolicyDefinitionGroup : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 817            writer.WriteStartObject();
 818            writer.WritePropertyName("name");
 819            writer.WriteStringValue(Name);
 820            if (DisplayName != null)
 21            {
 022                writer.WritePropertyName("displayName");
 023                writer.WriteStringValue(DisplayName);
 24            }
 825            if (Category != null)
 26            {
 027                writer.WritePropertyName("category");
 028                writer.WriteStringValue(Category);
 29            }
 830            if (Description != null)
 31            {
 032                writer.WritePropertyName("description");
 033                writer.WriteStringValue(Description);
 34            }
 835            if (AdditionalMetadataId != null)
 36            {
 037                writer.WritePropertyName("additionalMetadataId");
 038                writer.WriteStringValue(AdditionalMetadataId);
 39            }
 840            writer.WriteEndObject();
 841        }
 42
 43        internal static PolicyDefinitionGroup DeserializePolicyDefinitionGroup(JsonElement element)
 44        {
 1739245            string name = default;
 1739246            string displayName = default;
 1739247            string category = default;
 1739248            string description = default;
 1739249            string additionalMetadataId = default;
 10432050            foreach (var property in element.EnumerateObject())
 51            {
 3476852                if (property.NameEquals("name"))
 53                {
 1739254                    name = property.Value.GetString();
 1739255                    continue;
 56                }
 1737657                if (property.NameEquals("displayName"))
 58                {
 059                    if (property.Value.ValueKind == JsonValueKind.Null)
 60                    {
 61                        continue;
 62                    }
 063                    displayName = property.Value.GetString();
 064                    continue;
 65                }
 1737666                if (property.NameEquals("category"))
 67                {
 068                    if (property.Value.ValueKind == JsonValueKind.Null)
 69                    {
 70                        continue;
 71                    }
 072                    category = property.Value.GetString();
 073                    continue;
 74                }
 1737675                if (property.NameEquals("description"))
 76                {
 077                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 081                    description = property.Value.GetString();
 082                    continue;
 83                }
 1737684                if (property.NameEquals("additionalMetadataId"))
 85                {
 1737686                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 1737690                    additionalMetadataId = property.Value.GetString();
 91                    continue;
 92                }
 93            }
 1739294            return new PolicyDefinitionGroup(name, displayName, category, description, additionalMetadataId);
 95        }
 96    }
 97}