< Summary

Class:Azure.ResourceManager.Compute.Models.ImageReference
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageReference.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageReference.Serialization.cs
Covered lines:61
Uncovered lines:5
Coverable lines:66
Total lines:164
Line coverage:92.4% (61 of 66)
Covered branches:34
Total branches:38
Branch coverage:89.4% (34 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Publisher()-100%100%
get_Offer()-100%100%
get_Sku()-100%100%
get_Version()-100%100%
get_ExactVersion()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-90.48%91.67%
DeserializeImageReference(...)-90.32%88.46%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageReference.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> Specifies information about the image to use. You can specify information about platform images, marke
 11    public partial class ImageReference : SubResource
 12    {
 13        /// <summary> Initializes a new instance of ImageReference. </summary>
 28414        public ImageReference()
 15        {
 28416        }
 17
 18        /// <summary> Initializes a new instance of ImageReference. </summary>
 19        /// <param name="id"> Resource Id. </param>
 20        /// <param name="publisher"> The image publisher. </param>
 21        /// <param name="offer"> Specifies the offer of the platform image or marketplace image used to create the virtu
 22        /// <param name="sku"> The image SKU. </param>
 23        /// <param name="version"> Specifies the version of the platform image or marketplace image used to create the v
 24        /// <param name="exactVersion"> Specifies in decimal numbers, the version of platform image or marketplace image
 88025        internal ImageReference(string id, string publisher, string offer, string sku, string version, string exactVersi
 26        {
 88027            Publisher = publisher;
 88028            Offer = offer;
 88029            Sku = sku;
 88030            Version = version;
 88031            ExactVersion = exactVersion;
 88032        }
 33
 34        /// <summary> The image publisher. </summary>
 238435        public string Publisher { get; set; }
 36        /// <summary> Specifies the offer of the platform image or marketplace image used to create the virtual machine.
 238437        public string Offer { get; set; }
 38        /// <summary> The image SKU. </summary>
 238439        public string Sku { get; set; }
 40        /// <summary> Specifies the version of the platform image or marketplace image used to create the virtual machin
 240041        public string Version { get; set; }
 42        /// <summary> Specifies in decimal numbers, the version of platform image or marketplace image used to create th
 64043        public string ExactVersion { get; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageReference.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 ImageReference : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 60817            writer.WriteStartObject();
 60818            if (Publisher != null)
 19            {
 60820                writer.WritePropertyName("publisher");
 60821                writer.WriteStringValue(Publisher);
 22            }
 60823            if (Offer != null)
 24            {
 60825                writer.WritePropertyName("offer");
 60826                writer.WriteStringValue(Offer);
 27            }
 60828            if (Sku != null)
 29            {
 60830                writer.WritePropertyName("sku");
 60831                writer.WriteStringValue(Sku);
 32            }
 60833            if (Version != null)
 34            {
 60835                writer.WritePropertyName("version");
 60836                writer.WriteStringValue(Version);
 37            }
 60838            if (ExactVersion != null)
 39            {
 1640                writer.WritePropertyName("exactVersion");
 1641                writer.WriteStringValue(ExactVersion);
 42            }
 60843            if (Id != null)
 44            {
 045                writer.WritePropertyName("id");
 046                writer.WriteStringValue(Id);
 47            }
 60848            writer.WriteEndObject();
 60849        }
 50
 51        internal static ImageReference DeserializeImageReference(JsonElement element)
 52        {
 88053            string publisher = default;
 88054            string offer = default;
 88055            string sku = default;
 88056            string version = default;
 88057            string exactVersion = default;
 88058            string id = default;
 966459            foreach (var property in element.EnumerateObject())
 60            {
 395261                if (property.NameEquals("publisher"))
 62                {
 88063                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 88067                    publisher = property.Value.GetString();
 88068                    continue;
 69                }
 307270                if (property.NameEquals("offer"))
 71                {
 88072                    if (property.Value.ValueKind == JsonValueKind.Null)
 73                    {
 74                        continue;
 75                    }
 88076                    offer = property.Value.GetString();
 88077                    continue;
 78                }
 219279                if (property.NameEquals("sku"))
 80                {
 88081                    if (property.Value.ValueKind == JsonValueKind.Null)
 82                    {
 83                        continue;
 84                    }
 88085                    sku = property.Value.GetString();
 88086                    continue;
 87                }
 131288                if (property.NameEquals("version"))
 89                {
 88090                    if (property.Value.ValueKind == JsonValueKind.Null)
 91                    {
 92                        continue;
 93                    }
 88094                    version = property.Value.GetString();
 88095                    continue;
 96                }
 43297                if (property.NameEquals("exactVersion"))
 98                {
 43299                    if (property.Value.ValueKind == JsonValueKind.Null)
 100                    {
 101                        continue;
 102                    }
 432103                    exactVersion = property.Value.GetString();
 432104                    continue;
 105                }
 0106                if (property.NameEquals("id"))
 107                {
 0108                    if (property.Value.ValueKind == JsonValueKind.Null)
 109                    {
 110                        continue;
 111                    }
 0112                    id = property.Value.GetString();
 113                    continue;
 114                }
 115            }
 880116            return new ImageReference(id, publisher, offer, sku, version, exactVersion);
 117        }
 118    }
 119}