< Summary

Class:Azure.ResourceManager.Compute.Models.Image
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Image.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Image.Serialization.cs
Covered lines:87
Uncovered lines:15
Coverable lines:102
Total lines:239
Line coverage:85.2% (87 of 102)
Covered branches:55
Total branches:64
Branch coverage:85.9% (55 of 64)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_SourceVirtualMachine()-100%100%
get_StorageProfile()-100%100%
get_ProvisioningState()-100%100%
get_HyperVGeneration()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-72.22%72.22%
DeserializeImage(...)-92.31%93.18%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Image.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    /// <summary> The source user image virtual hard disk. The virtual hard disk will be copied before being attached to
 14    public partial class Image : Resource
 15    {
 16        /// <summary> Initializes a new instance of Image. </summary>
 17        /// <param name="location"> Resource location. </param>
 818        public Image(string location) : base(location)
 19        {
 820            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 824        }
 25
 26        /// <summary> Initializes a new instance of Image. </summary>
 27        /// <param name="id"> Resource Id. </param>
 28        /// <param name="name"> Resource name. </param>
 29        /// <param name="type"> Resource type. </param>
 30        /// <param name="location"> Resource location. </param>
 31        /// <param name="tags"> Resource tags. </param>
 32        /// <param name="sourceVirtualMachine"> The source virtual machine from which Image is created. </param>
 33        /// <param name="storageProfile"> Specifies the storage settings for the virtual machine disks. </param>
 34        /// <param name="provisioningState"> The provisioning state. </param>
 35        /// <param name="hyperVGeneration"> Gets the HyperVGenerationType of the VirtualMachine created from the image. 
 2836        internal Image(string id, string name, string type, string location, IDictionary<string, string> tags, SubResour
 37        {
 2838            SourceVirtualMachine = sourceVirtualMachine;
 2839            StorageProfile = storageProfile;
 2840            ProvisioningState = provisioningState;
 2841            HyperVGeneration = hyperVGeneration;
 2842        }
 43
 44        /// <summary> The source virtual machine from which Image is created. </summary>
 4445        public SubResource SourceVirtualMachine { get; set; }
 46        /// <summary> Specifies the storage settings for the virtual machine disks. </summary>
 12447        public ImageStorageProfile StorageProfile { get; set; }
 48        /// <summary> The provisioning state. </summary>
 2049        public string ProvisioningState { get; }
 50        /// <summary> Gets the HyperVGenerationType of the VirtualMachine created from the image. </summary>
 6851        public HyperVGenerationTypes? HyperVGeneration { get; set; }
 52    }
 53}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Image.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 Image : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 1624            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 1629            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 1634            writer.WritePropertyName("location");
 1635            writer.WriteStringValue(Location);
 1636            if (Tags != null)
 37            {
 1638                writer.WritePropertyName("tags");
 1639                writer.WriteStartObject();
 9640                foreach (var item in Tags)
 41                {
 3242                    writer.WritePropertyName(item.Key);
 3243                    writer.WriteStringValue(item.Value);
 44                }
 1645                writer.WriteEndObject();
 46            }
 1647            writer.WritePropertyName("properties");
 1648            writer.WriteStartObject();
 1649            if (SourceVirtualMachine != null)
 50            {
 051                writer.WritePropertyName("sourceVirtualMachine");
 052                writer.WriteObjectValue(SourceVirtualMachine);
 53            }
 1654            if (StorageProfile != null)
 55            {
 1656                writer.WritePropertyName("storageProfile");
 1657                writer.WriteObjectValue(StorageProfile);
 58            }
 1659            if (ProvisioningState != null)
 60            {
 061                writer.WritePropertyName("provisioningState");
 062                writer.WriteStringValue(ProvisioningState);
 63            }
 1664            if (HyperVGeneration != null)
 65            {
 1666                writer.WritePropertyName("hyperVGeneration");
 1667                writer.WriteStringValue(HyperVGeneration.Value.ToString());
 68            }
 1669            writer.WriteEndObject();
 1670            writer.WriteEndObject();
 1671        }
 72
 73        internal static Image DeserializeImage(JsonElement element)
 74        {
 2875            string id = default;
 2876            string name = default;
 2877            string type = default;
 2878            string location = default;
 2879            IDictionary<string, string> tags = default;
 2880            SubResource sourceVirtualMachine = default;
 2881            ImageStorageProfile storageProfile = default;
 2882            string provisioningState = default;
 2883            HyperVGenerationTypes? hyperVGeneration = default;
 37684            foreach (var property in element.EnumerateObject())
 85            {
 16086                if (property.NameEquals("id"))
 87                {
 2488                    if (property.Value.ValueKind == JsonValueKind.Null)
 89                    {
 90                        continue;
 91                    }
 2492                    id = property.Value.GetString();
 2493                    continue;
 94                }
 13695                if (property.NameEquals("name"))
 96                {
 2897                    if (property.Value.ValueKind == JsonValueKind.Null)
 98                    {
 99                        continue;
 100                    }
 28101                    name = property.Value.GetString();
 28102                    continue;
 103                }
 108104                if (property.NameEquals("type"))
 105                {
 24106                    if (property.Value.ValueKind == JsonValueKind.Null)
 107                    {
 108                        continue;
 109                    }
 24110                    type = property.Value.GetString();
 24111                    continue;
 112                }
 84113                if (property.NameEquals("location"))
 114                {
 24115                    location = property.Value.GetString();
 24116                    continue;
 117                }
 60118                if (property.NameEquals("tags"))
 119                {
 24120                    if (property.Value.ValueKind == JsonValueKind.Null)
 121                    {
 122                        continue;
 123                    }
 24124                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 160125                    foreach (var property0 in property.Value.EnumerateObject())
 126                    {
 56127                        if (property0.Value.ValueKind == JsonValueKind.Null)
 128                        {
 0129                            dictionary.Add(property0.Name, null);
 130                        }
 131                        else
 132                        {
 56133                            dictionary.Add(property0.Name, property0.Value.GetString());
 134                        }
 135                    }
 24136                    tags = dictionary;
 24137                    continue;
 138                }
 36139                if (property.NameEquals("properties"))
 140                {
 192141                    foreach (var property0 in property.Value.EnumerateObject())
 142                    {
 72143                        if (property0.NameEquals("sourceVirtualMachine"))
 144                        {
 0145                            if (property0.Value.ValueKind == JsonValueKind.Null)
 146                            {
 147                                continue;
 148                            }
 0149                            sourceVirtualMachine = SubResource.DeserializeSubResource(property0.Value);
 0150                            continue;
 151                        }
 72152                        if (property0.NameEquals("storageProfile"))
 153                        {
 24154                            if (property0.Value.ValueKind == JsonValueKind.Null)
 155                            {
 156                                continue;
 157                            }
 24158                            storageProfile = ImageStorageProfile.DeserializeImageStorageProfile(property0.Value);
 24159                            continue;
 160                        }
 48161                        if (property0.NameEquals("provisioningState"))
 162                        {
 24163                            if (property0.Value.ValueKind == JsonValueKind.Null)
 164                            {
 165                                continue;
 166                            }
 24167                            provisioningState = property0.Value.GetString();
 24168                            continue;
 169                        }
 24170                        if (property0.NameEquals("hyperVGeneration"))
 171                        {
 24172                            if (property0.Value.ValueKind == JsonValueKind.Null)
 173                            {
 174                                continue;
 175                            }
 24176                            hyperVGeneration = new HyperVGenerationTypes(property0.Value.GetString());
 177                            continue;
 178                        }
 179                    }
 180                    continue;
 181                }
 182            }
 28183            return new Image(id, name, type, location, tags, sourceVirtualMachine, storageProfile, provisioningState, hy
 184        }
 185    }
 186}