< Summary

Class:Azure.ResourceManager.Compute.Models.ImageDataDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDataDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDataDisk.Serialization.cs
Covered lines:52
Uncovered lines:21
Coverable lines:73
Total lines:179
Line coverage:71.2% (52 of 73)
Covered branches:33
Total branches:46
Branch coverage:71.7% (33 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_Lun()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-53.85%57.14%
DeserializeImageDataDisk(...)-77.5%78.13%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDataDisk.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> Describes a data disk. </summary>
 11    public partial class ImageDataDisk : ImageDisk
 12    {
 13        /// <summary> Initializes a new instance of ImageDataDisk. </summary>
 14        /// <param name="lun"> Specifies the logical unit number of the data disk. This value is used to identify data d
 415        public ImageDataDisk(int lun)
 16        {
 417            Lun = lun;
 418        }
 19
 20        /// <summary> Initializes a new instance of ImageDataDisk. </summary>
 21        /// <param name="snapshot"> The snapshot. </param>
 22        /// <param name="managedDisk"> The managedDisk. </param>
 23        /// <param name="blobUri"> The Virtual Hard Disk. </param>
 24        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 25        /// <param name="diskSizeGB"> Specifies the size of empty data disks in gigabytes. This element can be used to o
 26        /// <param name="storageAccountType"> Specifies the storage account type for the managed disk. NOTE: UltraSSD_LR
 27        /// <param name="diskEncryptionSet"> Specifies the customer managed disk encryption set resource id for the mana
 28        /// <param name="lun"> Specifies the logical unit number of the data disk. This value is used to identify data d
 1629        internal ImageDataDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int
 30        {
 1631            Lun = lun;
 1632        }
 33
 34        /// <summary> Specifies the logical unit number of the data disk. This value is used to identify data disks with
 3635        public int Lun { get; set; }
 36    }
 37}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDataDisk.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.Compute.Models
 12{
 13    public partial class ImageDataDisk : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 817            writer.WriteStartObject();
 818            writer.WritePropertyName("lun");
 819            writer.WriteNumberValue(Lun);
 820            if (Snapshot != null)
 21            {
 022                writer.WritePropertyName("snapshot");
 023                writer.WriteObjectValue(Snapshot);
 24            }
 825            if (ManagedDisk != null)
 26            {
 027                writer.WritePropertyName("managedDisk");
 028                writer.WriteObjectValue(ManagedDisk);
 29            }
 830            if (BlobUri != null)
 31            {
 832                writer.WritePropertyName("blobUri");
 833                writer.WriteStringValue(BlobUri);
 34            }
 835            if (Caching != null)
 36            {
 037                writer.WritePropertyName("caching");
 038                writer.WriteStringValue(Caching.Value.ToSerialString());
 39            }
 840            if (DiskSizeGB != null)
 41            {
 042                writer.WritePropertyName("diskSizeGB");
 043                writer.WriteNumberValue(DiskSizeGB.Value);
 44            }
 845            if (StorageAccountType != null)
 46            {
 047                writer.WritePropertyName("storageAccountType");
 048                writer.WriteStringValue(StorageAccountType.Value.ToString());
 49            }
 850            if (DiskEncryptionSet != null)
 51            {
 052                writer.WritePropertyName("diskEncryptionSet");
 053                writer.WriteObjectValue(DiskEncryptionSet);
 54            }
 855            writer.WriteEndObject();
 856        }
 57
 58        internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element)
 59        {
 1660            int lun = default;
 1661            SubResource snapshot = default;
 1662            SubResource managedDisk = default;
 1663            string blobUri = default;
 1664            CachingTypes? caching = default;
 1665            int? diskSizeGB = default;
 1666            StorageAccountTypes? storageAccountType = default;
 1667            SubResource diskEncryptionSet = default;
 19268            foreach (var property in element.EnumerateObject())
 69            {
 8070                if (property.NameEquals("lun"))
 71                {
 1672                    lun = property.Value.GetInt32();
 1673                    continue;
 74                }
 6475                if (property.NameEquals("snapshot"))
 76                {
 077                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 081                    snapshot = SubResource.DeserializeSubResource(property.Value);
 082                    continue;
 83                }
 6484                if (property.NameEquals("managedDisk"))
 85                {
 086                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 090                    managedDisk = SubResource.DeserializeSubResource(property.Value);
 091                    continue;
 92                }
 6493                if (property.NameEquals("blobUri"))
 94                {
 1695                    if (property.Value.ValueKind == JsonValueKind.Null)
 96                    {
 97                        continue;
 98                    }
 1699                    blobUri = property.Value.GetString();
 16100                    continue;
 101                }
 48102                if (property.NameEquals("caching"))
 103                {
 16104                    if (property.Value.ValueKind == JsonValueKind.Null)
 105                    {
 106                        continue;
 107                    }
 16108                    caching = property.Value.GetString().ToCachingTypes();
 16109                    continue;
 110                }
 32111                if (property.NameEquals("diskSizeGB"))
 112                {
 16113                    if (property.Value.ValueKind == JsonValueKind.Null)
 114                    {
 115                        continue;
 116                    }
 16117                    diskSizeGB = property.Value.GetInt32();
 16118                    continue;
 119                }
 16120                if (property.NameEquals("storageAccountType"))
 121                {
 16122                    if (property.Value.ValueKind == JsonValueKind.Null)
 123                    {
 124                        continue;
 125                    }
 16126                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
 16127                    continue;
 128                }
 0129                if (property.NameEquals("diskEncryptionSet"))
 130                {
 0131                    if (property.Value.ValueKind == JsonValueKind.Null)
 132                    {
 133                        continue;
 134                    }
 0135                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
 136                    continue;
 137                }
 138            }
 16139            return new ImageDataDisk(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryp
 140        }
 141    }
 142}