< Summary

Class:Azure.ResourceManager.Compute.Models.GalleryImageVersionStorageProfile
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionStorageProfile.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionStorageProfile.Serialization.cs
Covered lines:31
Uncovered lines:15
Coverable lines:46
Total lines:130
Line coverage:67.3% (31 of 46)
Covered branches:15
Total branches:26
Branch coverage:57.6% (15 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Source()-100%100%
get_OsDiskImage()-100%100%
get_DataDiskImages()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-53.33%50%
DeserializeGalleryImageVersionStorageProfile(...)-61.9%61.11%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionStorageProfile.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> This is the storage profile of a Gallery Image Version. </summary>
 13    public partial class GalleryImageVersionStorageProfile
 14    {
 15        /// <summary> Initializes a new instance of GalleryImageVersionStorageProfile. </summary>
 416        public GalleryImageVersionStorageProfile()
 17        {
 418        }
 19
 20        /// <summary> Initializes a new instance of GalleryImageVersionStorageProfile. </summary>
 21        /// <param name="source"> The gallery artifact version source. </param>
 22        /// <param name="osDiskImage"> This is the disk image base class. </param>
 23        /// <param name="dataDiskImages"> A list of data disk images. </param>
 2424        internal GalleryImageVersionStorageProfile(GalleryArtifactVersionSource source, GalleryDiskImage osDiskImage, IL
 25        {
 2426            Source = source;
 2427            OsDiskImage = osDiskImage;
 2428            DataDiskImages = dataDiskImages;
 2429        }
 30
 31        /// <summary> The gallery artifact version source. </summary>
 6832        public GalleryArtifactVersionSource Source { get; set; }
 33        /// <summary> This is the disk image base class. </summary>
 4034        public GalleryDiskImage OsDiskImage { get; set; }
 35        /// <summary> A list of data disk images. </summary>
 4036        public IList<GalleryDataDiskImage> DataDiskImages { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionStorageProfile.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 GalleryImageVersionStorageProfile : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (Source != null)
 20            {
 1621                writer.WritePropertyName("source");
 1622                writer.WriteObjectValue(Source);
 23            }
 1624            if (OsDiskImage != null)
 25            {
 026                writer.WritePropertyName("osDiskImage");
 027                writer.WriteObjectValue(OsDiskImage);
 28            }
 1629            if (DataDiskImages != null)
 30            {
 031                writer.WritePropertyName("dataDiskImages");
 032                writer.WriteStartArray();
 033                foreach (var item in DataDiskImages)
 34                {
 035                    writer.WriteObjectValue(item);
 36                }
 037                writer.WriteEndArray();
 38            }
 1639            writer.WriteEndObject();
 1640        }
 41
 42        internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement eleme
 43        {
 2444            GalleryArtifactVersionSource source = default;
 2445            GalleryDiskImage osDiskImage = default;
 2446            IList<GalleryDataDiskImage> dataDiskImages = default;
 14447            foreach (var property in element.EnumerateObject())
 48            {
 4849                if (property.NameEquals("source"))
 50                {
 2451                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 2455                    source = GalleryArtifactVersionSource.DeserializeGalleryArtifactVersionSource(property.Value);
 2456                    continue;
 57                }
 2458                if (property.NameEquals("osDiskImage"))
 59                {
 2460                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 2464                    osDiskImage = GalleryDiskImage.DeserializeGalleryDiskImage(property.Value);
 2465                    continue;
 66                }
 067                if (property.NameEquals("dataDiskImages"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    List<GalleryDataDiskImage> array = new List<GalleryDataDiskImage>();
 074                    foreach (var item in property.Value.EnumerateArray())
 75                    {
 076                        if (item.ValueKind == JsonValueKind.Null)
 77                        {
 078                            array.Add(null);
 79                        }
 80                        else
 81                        {
 082                            array.Add(GalleryDataDiskImage.DeserializeGalleryDataDiskImage(item));
 83                        }
 84                    }
 085                    dataDiskImages = array;
 86                    continue;
 87                }
 88            }
 2489            return new GalleryImageVersionStorageProfile(source, osDiskImage, dataDiskImages);
 90        }
 91    }
 92}