< Summary

Class:Azure.ResourceManager.Storage.Models.ObjectReplicationPolicyRule
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicyRule.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicyRule.Serialization.cs
Covered lines:48
Uncovered lines:2
Coverable lines:50
Total lines:130
Line coverage:96% (48 of 50)
Covered branches:20
Total branches:22
Branch coverage:90.9% (20 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_RuleId()-100%100%
get_SourceContainer()-100%100%
get_DestinationContainer()-100%100%
get_Filters()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeObjectReplicationPolicyRule(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicyRule.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 replication policy rule between two containers. </summary>
 13    public partial class ObjectReplicationPolicyRule
 14    {
 15        /// <summary> Initializes a new instance of ObjectReplicationPolicyRule. </summary>
 16        /// <param name="sourceContainer"> Required. Source container name. </param>
 17        /// <param name="destinationContainer"> Required. Destination container name. </param>
 818        public ObjectReplicationPolicyRule(string sourceContainer, string destinationContainer)
 19        {
 820            if (sourceContainer == null)
 21            {
 022                throw new ArgumentNullException(nameof(sourceContainer));
 23            }
 824            if (destinationContainer == null)
 25            {
 026                throw new ArgumentNullException(nameof(destinationContainer));
 27            }
 28
 829            SourceContainer = sourceContainer;
 830            DestinationContainer = destinationContainer;
 831        }
 32
 33        /// <summary> Initializes a new instance of ObjectReplicationPolicyRule. </summary>
 34        /// <param name="ruleId"> Rule Id is auto-generated for each new rule on destination account. It is required for
 35        /// <param name="sourceContainer"> Required. Source container name. </param>
 36        /// <param name="destinationContainer"> Required. Destination container name. </param>
 37        /// <param name="filters"> Optional. An object that defines the filter set. </param>
 4838        internal ObjectReplicationPolicyRule(string ruleId, string sourceContainer, string destinationContainer, ObjectR
 39        {
 4840            RuleId = ruleId;
 4841            SourceContainer = sourceContainer;
 4842            DestinationContainer = destinationContainer;
 4843            Filters = filters;
 4844        }
 45
 46        /// <summary> Rule Id is auto-generated for each new rule on destination account. It is required for put policy 
 11247        public string RuleId { get; set; }
 48        /// <summary> Required. Source container name. </summary>
 13649        public string SourceContainer { get; set; }
 50        /// <summary> Required. Destination container name. </summary>
 13651        public string DestinationContainer { get; set; }
 52        /// <summary> Optional. An object that defines the filter set. </summary>
 26853        public ObjectReplicationPolicyFilter Filters { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ObjectReplicationPolicyRule.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 ObjectReplicationPolicyRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            if (RuleId != null)
 19            {
 820                writer.WritePropertyName("ruleId");
 821                writer.WriteStringValue(RuleId);
 22            }
 1623            writer.WritePropertyName("sourceContainer");
 1624            writer.WriteStringValue(SourceContainer);
 1625            writer.WritePropertyName("destinationContainer");
 1626            writer.WriteStringValue(DestinationContainer);
 1627            if (Filters != null)
 28            {
 829                writer.WritePropertyName("filters");
 830                writer.WriteObjectValue(Filters);
 31            }
 1632            writer.WriteEndObject();
 1633        }
 34
 35        internal static ObjectReplicationPolicyRule DeserializeObjectReplicationPolicyRule(JsonElement element)
 36        {
 4837            string ruleId = default;
 4838            string sourceContainer = default;
 4839            string destinationContainer = default;
 4840            ObjectReplicationPolicyFilter filters = default;
 43241            foreach (var property in element.EnumerateObject())
 42            {
 16843                if (property.NameEquals("ruleId"))
 44                {
 4845                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 4849                    ruleId = property.Value.GetString();
 4850                    continue;
 51                }
 12052                if (property.NameEquals("sourceContainer"))
 53                {
 4854                    sourceContainer = property.Value.GetString();
 4855                    continue;
 56                }
 7257                if (property.NameEquals("destinationContainer"))
 58                {
 4859                    destinationContainer = property.Value.GetString();
 4860                    continue;
 61                }
 2462                if (property.NameEquals("filters"))
 63                {
 2464                    if (property.Value.ValueKind == JsonValueKind.Null)
 65                    {
 66                        continue;
 67                    }
 2468                    filters = ObjectReplicationPolicyFilter.DeserializeObjectReplicationPolicyFilter(property.Value);
 69                    continue;
 70                }
 71            }
 4872            return new ObjectReplicationPolicyRule(ruleId, sourceContainer, destinationContainer, filters);
 73        }
 74    }
 75}