< Summary

Class:Azure.ResourceManager.Compute.Models.ImageStorageProfile
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageStorageProfile.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageStorageProfile.Serialization.cs
Covered lines:45
Uncovered lines:1
Coverable lines:46
Total lines:130
Line coverage:97.8% (45 of 46)
Covered branches:25
Total branches:26
Branch coverage:96.1% (25 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_OsDisk()-100%100%
get_DataDisks()-100%100%
get_ZoneResilient()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeImageStorageProfile(...)-95.24%94.44%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageStorageProfile.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.Compute.Models
 11{
 12    /// <summary> Describes a storage profile. </summary>
 13    public partial class ImageStorageProfile
 14    {
 15        /// <summary> Initializes a new instance of ImageStorageProfile. </summary>
 816        public ImageStorageProfile()
 17        {
 818        }
 19
 20        /// <summary> Initializes a new instance of ImageStorageProfile. </summary>
 21        /// <param name="osDisk"> Specifies information about the operating system disk used by the virtual machine. &lt
 22        /// <param name="dataDisks"> Specifies the parameters that are used to add a data disk to a virtual machine. &lt
 23        /// <param name="zoneResilient"> Specifies whether an image is zone resilient or not. Default is false. Zone res
 2424        internal ImageStorageProfile(ImageOSDisk osDisk, IList<ImageDataDisk> dataDisks, bool? zoneResilient)
 25        {
 2426            OsDisk = osDisk;
 2427            DataDisks = dataDisks;
 2428            ZoneResilient = zoneResilient;
 2429        }
 30
 31        /// <summary> Specifies information about the operating system disk used by the virtual machine. &lt;br&gt;&lt;b
 9632        public ImageOSDisk OsDisk { get; set; }
 33        /// <summary> Specifies the parameters that are used to add a data disk to a virtual machine. &lt;br&gt;&lt;br&g
 6834        public IList<ImageDataDisk> DataDisks { get; set; }
 35        /// <summary> Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can b
 6036        public bool? ZoneResilient { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageStorageProfile.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.Compute.Models
 13{
 14    public partial class ImageStorageProfile : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (OsDisk != null)
 20            {
 1621                writer.WritePropertyName("osDisk");
 1622                writer.WriteObjectValue(OsDisk);
 23            }
 1624            if (DataDisks != null)
 25            {
 826                writer.WritePropertyName("dataDisks");
 827                writer.WriteStartArray();
 3228                foreach (var item in DataDisks)
 29                {
 830                    writer.WriteObjectValue(item);
 31                }
 832                writer.WriteEndArray();
 33            }
 1634            if (ZoneResilient != null)
 35            {
 836                writer.WritePropertyName("zoneResilient");
 837                writer.WriteBooleanValue(ZoneResilient.Value);
 38            }
 1639            writer.WriteEndObject();
 1640        }
 41
 42        internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement element)
 43        {
 2444            ImageOSDisk osDisk = default;
 2445            IList<ImageDataDisk> dataDisks = default;
 2446            bool? zoneResilient = default;
 16047            foreach (var property in element.EnumerateObject())
 48            {
 5649                if (property.NameEquals("osDisk"))
 50                {
 2451                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 2455                    osDisk = ImageOSDisk.DeserializeImageOSDisk(property.Value);
 2456                    continue;
 57                }
 3258                if (property.NameEquals("dataDisks"))
 59                {
 2460                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 2464                    List<ImageDataDisk> array = new List<ImageDataDisk>();
 8065                    foreach (var item in property.Value.EnumerateArray())
 66                    {
 1667                        if (item.ValueKind == JsonValueKind.Null)
 68                        {
 069                            array.Add(null);
 70                        }
 71                        else
 72                        {
 1673                            array.Add(ImageDataDisk.DeserializeImageDataDisk(item));
 74                        }
 75                    }
 2476                    dataDisks = array;
 2477                    continue;
 78                }
 879                if (property.NameEquals("zoneResilient"))
 80                {
 881                    if (property.Value.ValueKind == JsonValueKind.Null)
 82                    {
 83                        continue;
 84                    }
 885                    zoneResilient = property.Value.GetBoolean();
 86                    continue;
 87                }
 88            }
 2489            return new ImageStorageProfile(osDisk, dataDisks, zoneResilient);
 90        }
 91    }
 92}