< Summary

Class:Azure.ResourceManager.Compute.Models.GalleryDiskImage
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryDiskImage.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryDiskImage.Serialization.cs
Covered lines:21
Uncovered lines:17
Coverable lines:38
Total lines:110
Line coverage:55.2% (21 of 38)
Covered branches:14
Total branches:20
Branch coverage:70% (14 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_SizeInGB()-0%100%
get_HostCaching()-0%100%
get_Source()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeGalleryDiskImage(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryDiskImage.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> This is the disk image base class. </summary>
 11    public partial class GalleryDiskImage
 12    {
 13        /// <summary> Initializes a new instance of GalleryDiskImage. </summary>
 014        public GalleryDiskImage()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of GalleryDiskImage. </summary>
 19        /// <param name="sizeInGB"> This property indicates the size of the VHD to be created. </param>
 20        /// <param name="hostCaching"> The host caching of the disk. Valid values are &apos;None&apos;, &apos;ReadOnly&a
 21        /// <param name="source"> The gallery artifact version source. </param>
 2422        internal GalleryDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryArtifactVersionSource source)
 23        {
 2424            SizeInGB = sizeInGB;
 2425            HostCaching = hostCaching;
 2426            Source = source;
 2427        }
 28
 29        /// <summary> This property indicates the size of the VHD to be created. </summary>
 030        public int? SizeInGB { get; }
 31        /// <summary> The host caching of the disk. Valid values are &apos;None&apos;, &apos;ReadOnly&apos;, and &apos;R
 032        public HostCaching? HostCaching { get; set; }
 33        /// <summary> The gallery artifact version source. </summary>
 034        public GalleryArtifactVersionSource Source { get; set; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryDiskImage.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 GalleryDiskImage : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (SizeInGB != null)
 19            {
 020                writer.WritePropertyName("sizeInGB");
 021                writer.WriteNumberValue(SizeInGB.Value);
 22            }
 023            if (HostCaching != null)
 24            {
 025                writer.WritePropertyName("hostCaching");
 026                writer.WriteStringValue(HostCaching.Value.ToSerialString());
 27            }
 028            if (Source != null)
 29            {
 030                writer.WritePropertyName("source");
 031                writer.WriteObjectValue(Source);
 32            }
 033            writer.WriteEndObject();
 034        }
 35
 36        internal static GalleryDiskImage DeserializeGalleryDiskImage(JsonElement element)
 37        {
 2438            int? sizeInGB = default;
 2439            HostCaching? hostCaching = default;
 2440            GalleryArtifactVersionSource source = default;
 19241            foreach (var property in element.EnumerateObject())
 42            {
 7243                if (property.NameEquals("sizeInGB"))
 44                {
 2445                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 2449                    sizeInGB = property.Value.GetInt32();
 2450                    continue;
 51                }
 4852                if (property.NameEquals("hostCaching"))
 53                {
 2454                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 2458                    hostCaching = property.Value.GetString().ToHostCaching();
 2459                    continue;
 60                }
 2461                if (property.NameEquals("source"))
 62                {
 2463                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 2467                    source = GalleryArtifactVersionSource.DeserializeGalleryArtifactVersionSource(property.Value);
 68                    continue;
 69                }
 70            }
 2471            return new GalleryDiskImage(sizeInGB, hostCaching, source);
 72        }
 73    }
 74}