< Summary

Class:Azure.ResourceManager.Storage.Models.ManagementPolicyDefinition
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyDefinition.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyDefinition.Serialization.cs
Covered lines:28
Uncovered lines:1
Coverable lines:29
Total lines:93
Line coverage:96.5% (28 of 29)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Actions()-100%100%
get_Filters()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeManagementPolicyDefinition(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyDefinition.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> An object that defines the Lifecycle rule. Each definition is made up with a filters set and an action
 13    public partial class ManagementPolicyDefinition
 14    {
 15        /// <summary> Initializes a new instance of ManagementPolicyDefinition. </summary>
 16        /// <param name="actions"> An object that defines the action set. </param>
 1217        public ManagementPolicyDefinition(ManagementPolicyAction actions)
 18        {
 1219            if (actions == null)
 20            {
 021                throw new ArgumentNullException(nameof(actions));
 22            }
 23
 1224            Actions = actions;
 1225        }
 26
 27        /// <summary> Initializes a new instance of ManagementPolicyDefinition. </summary>
 28        /// <param name="actions"> An object that defines the action set. </param>
 29        /// <param name="filters"> An object that defines the filter set. </param>
 2430        internal ManagementPolicyDefinition(ManagementPolicyAction actions, ManagementPolicyFilter filters)
 31        {
 2432            Actions = actions;
 2433            Filters = filters;
 2434        }
 35
 36        /// <summary> An object that defines the action set. </summary>
 24037        public ManagementPolicyAction Actions { get; set; }
 38        /// <summary> An object that defines the filter set. </summary>
 18039        public ManagementPolicyFilter Filters { get; set; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyDefinition.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.Storage.Models
 12{
 13    public partial class ManagementPolicyDefinition : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1217            writer.WriteStartObject();
 1218            writer.WritePropertyName("actions");
 1219            writer.WriteObjectValue(Actions);
 1220            if (Filters != null)
 21            {
 1222                writer.WritePropertyName("filters");
 1223                writer.WriteObjectValue(Filters);
 24            }
 1225            writer.WriteEndObject();
 1226        }
 27
 28        internal static ManagementPolicyDefinition DeserializeManagementPolicyDefinition(JsonElement element)
 29        {
 2430            ManagementPolicyAction actions = default;
 2431            ManagementPolicyFilter filters = default;
 14432            foreach (var property in element.EnumerateObject())
 33            {
 4834                if (property.NameEquals("actions"))
 35                {
 2436                    actions = ManagementPolicyAction.DeserializeManagementPolicyAction(property.Value);
 2437                    continue;
 38                }
 2439                if (property.NameEquals("filters"))
 40                {
 2441                    if (property.Value.ValueKind == JsonValueKind.Null)
 42                    {
 43                        continue;
 44                    }
 2445                    filters = ManagementPolicyFilter.DeserializeManagementPolicyFilter(property.Value);
 46                    continue;
 47                }
 48            }
 2449            return new ManagementPolicyDefinition(actions, filters);
 50        }
 51    }
 52}