< Summary

Class:Azure.ResourceManager.Compute.Models.ImageOSDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageOSDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageOSDisk.Serialization.cs
Covered lines:61
Uncovered lines:21
Coverable lines:82
Total lines:193
Line coverage:74.3% (61 of 82)
Covered branches:35
Total branches:48
Branch coverage:72.9% (35 of 48)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_OsType()-100%100%
get_OsState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-57.14%57.14%
DeserializeImageOSDisk(...)-79.55%79.41%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageOSDisk.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 an Operating System disk. </summary>
 11    public partial class ImageOSDisk : ImageDisk
 12    {
 13        /// <summary> Initializes a new instance of ImageOSDisk. </summary>
 14        /// <param name="osType"> This property allows you to specify the type of the OS that is included in the disk if
 15        /// <param name="osState"> The OS State. </param>
 816        public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState)
 17        {
 818            OsType = osType;
 819            OsState = osState;
 820        }
 21
 22        /// <summary> Initializes a new instance of ImageOSDisk. </summary>
 23        /// <param name="snapshot"> The snapshot. </param>
 24        /// <param name="managedDisk"> The managedDisk. </param>
 25        /// <param name="blobUri"> The Virtual Hard Disk. </param>
 26        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 27        /// <param name="diskSizeGB"> Specifies the size of empty data disks in gigabytes. This element can be used to o
 28        /// <param name="storageAccountType"> Specifies the storage account type for the managed disk. NOTE: UltraSSD_LR
 29        /// <param name="diskEncryptionSet"> Specifies the customer managed disk encryption set resource id for the mana
 30        /// <param name="osType"> This property allows you to specify the type of the OS that is included in the disk if
 31        /// <param name="osState"> The OS State. </param>
 2432        internal ImageOSDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int? 
 33        {
 2434            OsType = osType;
 2435            OsState = osState;
 2436        }
 37
 38        /// <summary> This property allows you to specify the type of the OS that is included in the disk if creating a 
 5639        public OperatingSystemTypes OsType { get; set; }
 40        /// <summary> The OS State. </summary>
 5641        public OperatingSystemStateTypes OsState { get; set; }
 42    }
 43}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageOSDisk.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 ImageOSDisk : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            writer.WritePropertyName("osType");
 1619            writer.WriteStringValue(OsType.ToSerialString());
 1620            writer.WritePropertyName("osState");
 1621            writer.WriteStringValue(OsState.ToSerialString());
 1622            if (Snapshot != null)
 23            {
 024                writer.WritePropertyName("snapshot");
 025                writer.WriteObjectValue(Snapshot);
 26            }
 1627            if (ManagedDisk != null)
 28            {
 029                writer.WritePropertyName("managedDisk");
 030                writer.WriteObjectValue(ManagedDisk);
 31            }
 1632            if (BlobUri != null)
 33            {
 1634                writer.WritePropertyName("blobUri");
 1635                writer.WriteStringValue(BlobUri);
 36            }
 1637            if (Caching != null)
 38            {
 039                writer.WritePropertyName("caching");
 040                writer.WriteStringValue(Caching.Value.ToSerialString());
 41            }
 1642            if (DiskSizeGB != null)
 43            {
 044                writer.WritePropertyName("diskSizeGB");
 045                writer.WriteNumberValue(DiskSizeGB.Value);
 46            }
 1647            if (StorageAccountType != null)
 48            {
 049                writer.WritePropertyName("storageAccountType");
 050                writer.WriteStringValue(StorageAccountType.Value.ToString());
 51            }
 1652            if (DiskEncryptionSet != null)
 53            {
 054                writer.WritePropertyName("diskEncryptionSet");
 055                writer.WriteObjectValue(DiskEncryptionSet);
 56            }
 1657            writer.WriteEndObject();
 1658        }
 59
 60        internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element)
 61        {
 2462            OperatingSystemTypes osType = default;
 2463            OperatingSystemStateTypes osState = default;
 2464            SubResource snapshot = default;
 2465            SubResource managedDisk = default;
 2466            string blobUri = default;
 2467            CachingTypes? caching = default;
 2468            int? diskSizeGB = default;
 2469            StorageAccountTypes? storageAccountType = default;
 2470            SubResource diskEncryptionSet = default;
 33671            foreach (var property in element.EnumerateObject())
 72            {
 14473                if (property.NameEquals("osType"))
 74                {
 2475                    osType = property.Value.GetString().ToOperatingSystemTypes();
 2476                    continue;
 77                }
 12078                if (property.NameEquals("osState"))
 79                {
 2480                    osState = property.Value.GetString().ToOperatingSystemStateTypes();
 2481                    continue;
 82                }
 9683                if (property.NameEquals("snapshot"))
 84                {
 085                    if (property.Value.ValueKind == JsonValueKind.Null)
 86                    {
 87                        continue;
 88                    }
 089                    snapshot = SubResource.DeserializeSubResource(property.Value);
 090                    continue;
 91                }
 9692                if (property.NameEquals("managedDisk"))
 93                {
 094                    if (property.Value.ValueKind == JsonValueKind.Null)
 95                    {
 96                        continue;
 97                    }
 098                    managedDisk = SubResource.DeserializeSubResource(property.Value);
 099                    continue;
 100                }
 96101                if (property.NameEquals("blobUri"))
 102                {
 24103                    if (property.Value.ValueKind == JsonValueKind.Null)
 104                    {
 105                        continue;
 106                    }
 24107                    blobUri = property.Value.GetString();
 24108                    continue;
 109                }
 72110                if (property.NameEquals("caching"))
 111                {
 24112                    if (property.Value.ValueKind == JsonValueKind.Null)
 113                    {
 114                        continue;
 115                    }
 24116                    caching = property.Value.GetString().ToCachingTypes();
 24117                    continue;
 118                }
 48119                if (property.NameEquals("diskSizeGB"))
 120                {
 24121                    if (property.Value.ValueKind == JsonValueKind.Null)
 122                    {
 123                        continue;
 124                    }
 24125                    diskSizeGB = property.Value.GetInt32();
 24126                    continue;
 127                }
 24128                if (property.NameEquals("storageAccountType"))
 129                {
 24130                    if (property.Value.ValueKind == JsonValueKind.Null)
 131                    {
 132                        continue;
 133                    }
 24134                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
 24135                    continue;
 136                }
 0137                if (property.NameEquals("diskEncryptionSet"))
 138                {
 0139                    if (property.Value.ValueKind == JsonValueKind.Null)
 140                    {
 141                        continue;
 142                    }
 0143                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
 144                    continue;
 145                }
 146            }
 24147            return new ImageOSDisk(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncrypti
 148        }
 149    }
 150}