< Summary

Class:Azure.ResourceManager.Storage.Models.LegalHoldProperties
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\LegalHoldProperties.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\LegalHoldProperties.Serialization.cs
Covered lines:21
Uncovered lines:15
Coverable lines:36
Total lines:111
Line coverage:58.3% (21 of 36)
Covered branches:13
Total branches:20
Branch coverage:65% (13 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_HasLegalHold()-100%100%
get_Tags()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeLegalHoldProperties(...)-93.75%92.86%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\LegalHoldProperties.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;
 9
 10namespace Azure.ResourceManager.Storage.Models
 11{
 12    /// <summary> The LegalHold property of a blob container. </summary>
 13    public partial class LegalHoldProperties
 14    {
 15        /// <summary> Initializes a new instance of LegalHoldProperties. </summary>
 016        public LegalHoldProperties()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of LegalHoldProperties. </summary>
 21        /// <param name="hasLegalHold"> The hasLegalHold public property is set to true by SRP if there are at least one
 22        /// <param name="tags"> The list of LegalHold tags of a blob container. </param>
 1223        internal LegalHoldProperties(bool? hasLegalHold, IList<TagProperty> tags)
 24        {
 1225            HasLegalHold = hasLegalHold;
 1226            Tags = tags;
 1227        }
 28
 29        /// <summary> The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The
 430        public bool? HasLegalHold { get; }
 31        /// <summary> The list of LegalHold tags of a blob container. </summary>
 2832        public IList<TagProperty> Tags { get; set; }
 33    }
 34}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\LegalHoldProperties.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 LegalHoldProperties : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (HasLegalHold != null)
 20            {
 021                writer.WritePropertyName("hasLegalHold");
 022                writer.WriteBooleanValue(HasLegalHold.Value);
 23            }
 024            if (Tags != null)
 25            {
 026                writer.WritePropertyName("tags");
 027                writer.WriteStartArray();
 028                foreach (var item in Tags)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 034            writer.WriteEndObject();
 035        }
 36
 37        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
 38        {
 1239            bool? hasLegalHold = default;
 1240            IList<TagProperty> tags = default;
 7241            foreach (var property in element.EnumerateObject())
 42            {
 2443                if (property.NameEquals("hasLegalHold"))
 44                {
 1245                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 1249                    hasLegalHold = property.Value.GetBoolean();
 1250                    continue;
 51                }
 1252                if (property.NameEquals("tags"))
 53                {
 1254                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 1258                    List<TagProperty> array = new List<TagProperty>();
 4859                    foreach (var item in property.Value.EnumerateArray())
 60                    {
 1261                        if (item.ValueKind == JsonValueKind.Null)
 62                        {
 063                            array.Add(null);
 64                        }
 65                        else
 66                        {
 1267                            array.Add(TagProperty.DeserializeTagProperty(item));
 68                        }
 69                    }
 1270                    tags = array;
 71                    continue;
 72                }
 73            }
 1274            return new LegalHoldProperties(hasLegalHold, tags);
 75        }
 76    }
 77}