< Summary

Class:Azure.ResourceManager.Storage.Models.ManagementPolicySchema
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicySchema.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicySchema.Serialization.cs
Covered lines:21
Uncovered lines:6
Coverable lines:27
Total lines:94
Line coverage:77.7% (21 of 27)
Covered branches:10
Total branches:14
Branch coverage:71.4% (10 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%50%
get_Rules()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeManagementPolicySchema(...)-90%87.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicySchema.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;
 10using System.Linq;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    /// <summary> The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/az
 15    public partial class ManagementPolicySchema
 16    {
 17        /// <summary> Initializes a new instance of ManagementPolicySchema. </summary>
 18        /// <param name="rules"> The Storage Account ManagementPolicies Rules. See more details in: https://docs.microso
 019        public ManagementPolicySchema(IEnumerable<ManagementPolicyRule> rules)
 20        {
 021            if (rules == null)
 22            {
 023                throw new ArgumentNullException(nameof(rules));
 24            }
 25
 026            Rules = rules.ToList();
 027        }
 28
 29        /// <summary> Initializes a new instance of ManagementPolicySchema. </summary>
 30        /// <param name="rules"> The Storage Account ManagementPolicies Rules. See more details in: https://docs.microso
 1231        internal ManagementPolicySchema(IList<ManagementPolicyRule> rules)
 32        {
 1233            Rules = rules ?? new List<ManagementPolicyRule>();
 1234        }
 35
 36        /// <summary> The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-u
 5237        public IList<ManagementPolicyRule> Rules { get; }
 38    }
 39}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicySchema.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.Storage.Models
 13{
 14    public partial class ManagementPolicySchema : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            writer.WritePropertyName("rules");
 420            writer.WriteStartArray();
 3221            foreach (var item in Rules)
 22            {
 1223                writer.WriteObjectValue(item);
 24            }
 425            writer.WriteEndArray();
 426            writer.WriteEndObject();
 427        }
 28
 29        internal static ManagementPolicySchema DeserializeManagementPolicySchema(JsonElement element)
 30        {
 831            IList<ManagementPolicyRule> rules = default;
 3232            foreach (var property in element.EnumerateObject())
 33            {
 834                if (property.NameEquals("rules"))
 35                {
 836                    List<ManagementPolicyRule> array = new List<ManagementPolicyRule>();
 6437                    foreach (var item in property.Value.EnumerateArray())
 38                    {
 2439                        if (item.ValueKind == JsonValueKind.Null)
 40                        {
 041                            array.Add(null);
 42                        }
 43                        else
 44                        {
 2445                            array.Add(ManagementPolicyRule.DeserializeManagementPolicyRule(item));
 46                        }
 47                    }
 848                    rules = array;
 49                    continue;
 50                }
 51            }
 852            return new ManagementPolicySchema(rules);
 53        }
 54    }
 55}