< Summary

Class:Azure.ResourceManager.Storage.Models.ManagementPolicy
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicy.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicy.Serialization.cs
Covered lines:49
Uncovered lines:8
Coverable lines:57
Total lines:152
Line coverage:85.9% (49 of 57)
Covered branches:32
Total branches:36
Branch coverage:88.8% (32 of 36)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_LastModifiedTime()-100%100%
get_Policy()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-61.9%60%
DeserializeManagementPolicy(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicy.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.Storage.Models
 11{
 12    /// <summary> The Get Storage Account ManagementPolicies operation response. </summary>
 13    public partial class ManagementPolicy : Resource
 14    {
 15        /// <summary> Initializes a new instance of ManagementPolicy. </summary>
 416        public ManagementPolicy()
 17        {
 418        }
 19
 20        /// <summary> Initializes a new instance of ManagementPolicy. </summary>
 21        /// <param name="id"> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourc
 22        /// <param name="name"> The name of the resource. </param>
 23        /// <param name="type"> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/sto
 24        /// <param name="lastModifiedTime"> Returns the date and time the ManagementPolicies was last modified. </param>
 25        /// <param name="policy"> The Storage Account ManagementPolicy, in JSON format. See more details in: https://doc
 826        internal ManagementPolicy(string id, string name, string type, DateTimeOffset? lastModifiedTime, ManagementPolic
 27        {
 828            LastModifiedTime = lastModifiedTime;
 829            Policy = policy;
 830        }
 31
 32        /// <summary> Returns the date and time the ManagementPolicies was last modified. </summary>
 433        public DateTimeOffset? LastModifiedTime { get; }
 34        /// <summary> The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.
 2835        public ManagementPolicySchema Policy { get; set; }
 36    }
 37}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicy.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;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    public partial class ManagementPolicy : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 424            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 429            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 434            writer.WritePropertyName("properties");
 435            writer.WriteStartObject();
 436            if (LastModifiedTime != null)
 37            {
 038                writer.WritePropertyName("lastModifiedTime");
 039                writer.WriteStringValue(LastModifiedTime.Value, "O");
 40            }
 441            if (Policy != null)
 42            {
 443                writer.WritePropertyName("policy");
 444                writer.WriteObjectValue(Policy);
 45            }
 446            writer.WriteEndObject();
 447            writer.WriteEndObject();
 448        }
 49
 50        internal static ManagementPolicy DeserializeManagementPolicy(JsonElement element)
 51        {
 852            string id = default;
 853            string name = default;
 854            string type = default;
 855            DateTimeOffset? lastModifiedTime = default;
 856            ManagementPolicySchema policy = default;
 8057            foreach (var property in element.EnumerateObject())
 58            {
 3259                if (property.NameEquals("id"))
 60                {
 861                    if (property.Value.ValueKind == JsonValueKind.Null)
 62                    {
 63                        continue;
 64                    }
 865                    id = property.Value.GetString();
 866                    continue;
 67                }
 2468                if (property.NameEquals("name"))
 69                {
 870                    if (property.Value.ValueKind == JsonValueKind.Null)
 71                    {
 72                        continue;
 73                    }
 874                    name = property.Value.GetString();
 875                    continue;
 76                }
 1677                if (property.NameEquals("type"))
 78                {
 879                    if (property.Value.ValueKind == JsonValueKind.Null)
 80                    {
 81                        continue;
 82                    }
 883                    type = property.Value.GetString();
 884                    continue;
 85                }
 886                if (property.NameEquals("properties"))
 87                {
 4888                    foreach (var property0 in property.Value.EnumerateObject())
 89                    {
 1690                        if (property0.NameEquals("lastModifiedTime"))
 91                        {
 892                            if (property0.Value.ValueKind == JsonValueKind.Null)
 93                            {
 94                                continue;
 95                            }
 896                            lastModifiedTime = property0.Value.GetDateTimeOffset("O");
 897                            continue;
 98                        }
 899                        if (property0.NameEquals("policy"))
 100                        {
 8101                            if (property0.Value.ValueKind == JsonValueKind.Null)
 102                            {
 103                                continue;
 104                            }
 8105                            policy = ManagementPolicySchema.DeserializeManagementPolicySchema(property0.Value);
 106                            continue;
 107                        }
 108                    }
 109                    continue;
 110                }
 111            }
 8112            return new ManagementPolicy(id, name, type, lastModifiedTime, policy);
 113        }
 114    }
 115}