< Summary

Class:Azure.ResourceManager.Compute.Models.StorageProfile
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\StorageProfile.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\StorageProfile.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_ImageReference()-100%100%
get_OsDisk()-100%100%
get_DataDisks()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeStorageProfile(...)-95.24%94.44%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\StorageProfile.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> Specifies the storage settings for the virtual machine disks. </summary>
 13    public partial class StorageProfile
 14    {
 15        /// <summary> Initializes a new instance of StorageProfile. </summary>
 14816        public StorageProfile()
 17        {
 14818        }
 19
 20        /// <summary> Initializes a new instance of StorageProfile. </summary>
 21        /// <param name="imageReference"> Specifies information about the image to use. You can specify information abou
 22        /// <param name="osDisk"> Specifies information about the operating system disk used by the virtual machine. &lt
 23        /// <param name="dataDisks"> Specifies the parameters that are used to add a data disk to a virtual machine. &lt
 43224        internal StorageProfile(ImageReference imageReference, OSDisk osDisk, IList<DataDisk> dataDisks)
 25        {
 43226            ImageReference = imageReference;
 43227            OsDisk = osDisk;
 43228            DataDisks = dataDisks;
 43229        }
 30
 31        /// <summary> Specifies information about the image to use. You can specify information about platform images, m
 108432        public ImageReference ImageReference { get; set; }
 33        /// <summary> Specifies information about the operating system disk used by the virtual machine. &lt;br&gt;&lt;b
 295234        public OSDisk OsDisk { get; set; }
 35        /// <summary> Specifies the parameters that are used to add a data disk to a virtual machine. &lt;br&gt;&lt;br&g
 140836        public IList<DataDisk> DataDisks { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\StorageProfile.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 StorageProfile : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 24418            writer.WriteStartObject();
 24419            if (ImageReference != null)
 20            {
 24421                writer.WritePropertyName("imageReference");
 24422                writer.WriteObjectValue(ImageReference);
 23            }
 24424            if (OsDisk != null)
 25            {
 24426                writer.WritePropertyName("osDisk");
 24427                writer.WriteObjectValue(OsDisk);
 28            }
 24429            if (DataDisks != null)
 30            {
 6431                writer.WritePropertyName("dataDisks");
 6432                writer.WriteStartArray();
 28833                foreach (var item in DataDisks)
 34                {
 8035                    writer.WriteObjectValue(item);
 36                }
 6437                writer.WriteEndArray();
 38            }
 24439            writer.WriteEndObject();
 24440        }
 41
 42        internal static StorageProfile DeserializeStorageProfile(JsonElement element)
 43        {
 43244            ImageReference imageReference = default;
 43245            OSDisk osDisk = default;
 43246            IList<DataDisk> dataDisks = default;
 341647            foreach (var property in element.EnumerateObject())
 48            {
 127649                if (property.NameEquals("imageReference"))
 50                {
 43251                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 43255                    imageReference = ImageReference.DeserializeImageReference(property.Value);
 43256                    continue;
 57                }
 84458                if (property.NameEquals("osDisk"))
 59                {
 43260                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 43264                    osDisk = OSDisk.DeserializeOSDisk(property.Value);
 43265                    continue;
 66                }
 41267                if (property.NameEquals("dataDisks"))
 68                {
 41269                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 41273                    List<DataDisk> array = new List<DataDisk>();
 118474                    foreach (var item in property.Value.EnumerateArray())
 75                    {
 18076                        if (item.ValueKind == JsonValueKind.Null)
 77                        {
 078                            array.Add(null);
 79                        }
 80                        else
 81                        {
 18082                            array.Add(DataDisk.DeserializeDataDisk(item));
 83                        }
 84                    }
 41285                    dataDisks = array;
 86                    continue;
 87                }
 88            }
 43289            return new StorageProfile(imageReference, osDisk, dataDisks);
 90        }
 91    }
 92}