< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineImageResource
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineImageResource.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineImageResource.Serialization.cs
Covered lines:23
Uncovered lines:34
Coverable lines:57
Total lines:147
Line coverage:40.3% (23 of 57)
Covered branches:12
Total branches:28
Branch coverage:42.8% (12 of 28)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Name()-100%100%
get_Location()-100%100%
get_Tags()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVirtualMachineImageResource(...)-66.67%66.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineImageResource.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> Virtual machine image resource information. </summary>
 14    public partial class VirtualMachineImageResource : SubResource
 15    {
 16        /// <summary> Initializes a new instance of VirtualMachineImageResource. </summary>
 17        /// <param name="name"> The name of the resource. </param>
 18        /// <param name="location"> The supported Azure location of the resource. </param>
 019        public VirtualMachineImageResource(string name, string location)
 20        {
 021            if (name == null)
 22            {
 023                throw new ArgumentNullException(nameof(name));
 24            }
 025            if (location == null)
 26            {
 027                throw new ArgumentNullException(nameof(location));
 28            }
 29
 030            Name = name;
 031            Location = location;
 032        }
 33
 34        /// <summary> Initializes a new instance of VirtualMachineImageResource. </summary>
 35        /// <param name="id"> Resource Id. </param>
 36        /// <param name="name"> The name of the resource. </param>
 37        /// <param name="location"> The supported Azure location of the resource. </param>
 38        /// <param name="tags"> Specifies the tags that are assigned to the virtual machine. For more information about 
 638439        internal VirtualMachineImageResource(string id, string name, string location, IDictionary<string, string> tags) 
 40        {
 638441            Name = name;
 638442            Location = location;
 638443            Tags = tags;
 638444        }
 45
 46        /// <summary> The name of the resource. </summary>
 1240847        public string Name { get; set; }
 48        /// <summary> The supported Azure location of the resource. </summary>
 638849        public string Location { get; set; }
 50        /// <summary> Specifies the tags that are assigned to the virtual machine. For more information about using tags
 051        public IDictionary<string, string> Tags { get; set; }
 52    }
 53}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineImageResource.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 VirtualMachineImageResource : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("name");
 020            writer.WriteStringValue(Name);
 021            writer.WritePropertyName("location");
 022            writer.WriteStringValue(Location);
 023            if (Tags != null)
 24            {
 025                writer.WritePropertyName("tags");
 026                writer.WriteStartObject();
 027                foreach (var item in Tags)
 28                {
 029                    writer.WritePropertyName(item.Key);
 030                    writer.WriteStringValue(item.Value);
 31                }
 032                writer.WriteEndObject();
 33            }
 034            if (Id != null)
 35            {
 036                writer.WritePropertyName("id");
 037                writer.WriteStringValue(Id);
 38            }
 039            writer.WriteEndObject();
 040        }
 41
 42        internal static VirtualMachineImageResource DeserializeVirtualMachineImageResource(JsonElement element)
 43        {
 635244            string name = default;
 635245            string location = default;
 635246            IDictionary<string, string> tags = default;
 635247            string id = default;
 5152848            foreach (var property in element.EnumerateObject())
 49            {
 1941250                if (property.NameEquals("name"))
 51                {
 635252                    name = property.Value.GetString();
 635253                    continue;
 54                }
 1306055                if (property.NameEquals("location"))
 56                {
 635257                    location = property.Value.GetString();
 635258                    continue;
 59                }
 670860                if (property.NameEquals("tags"))
 61                {
 062                    if (property.Value.ValueKind == JsonValueKind.Null)
 63                    {
 64                        continue;
 65                    }
 066                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 067                    foreach (var property0 in property.Value.EnumerateObject())
 68                    {
 069                        if (property0.Value.ValueKind == JsonValueKind.Null)
 70                        {
 071                            dictionary.Add(property0.Name, null);
 72                        }
 73                        else
 74                        {
 075                            dictionary.Add(property0.Name, property0.Value.GetString());
 76                        }
 77                    }
 078                    tags = dictionary;
 079                    continue;
 80                }
 670881                if (property.NameEquals("id"))
 82                {
 635283                    if (property.Value.ValueKind == JsonValueKind.Null)
 84                    {
 85                        continue;
 86                    }
 635287                    id = property.Value.GetString();
 88                    continue;
 89                }
 90            }
 635291            return new VirtualMachineImageResource(id, name, location, tags);
 92        }
 93    }
 94}