< Summary

Class:Azure.ResourceManager.Network.Models.VM
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VM.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VM.Serialization.cs
Covered lines:0
Uncovered lines:57
Coverable lines:57
Total lines:153
Line coverage:0% (0 of 57)
Covered branches:0
Total branches:38
Branch coverage:0% (0 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVM(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VM.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.Network.Models
 11{
 12    /// <summary> Describes a Virtual Machine. </summary>
 13    public partial class VM : Resource
 14    {
 15        /// <summary> Initializes a new instance of VM. </summary>
 016        public VM()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of VM. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 026        internal VM(string id, string name, string type, string location, IDictionary<string, string> tags) : base(id, n
 27        {
 028        }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VM.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.Network.Models
 13{
 14    public partial class VM : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 024            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 029            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 034            if (Location != null)
 35            {
 036                writer.WritePropertyName("location");
 037                writer.WriteStringValue(Location);
 38            }
 039            if (Tags != null)
 40            {
 041                writer.WritePropertyName("tags");
 042                writer.WriteStartObject();
 043                foreach (var item in Tags)
 44                {
 045                    writer.WritePropertyName(item.Key);
 046                    writer.WriteStringValue(item.Value);
 47                }
 048                writer.WriteEndObject();
 49            }
 050            writer.WriteEndObject();
 051        }
 52
 53        internal static VM DeserializeVM(JsonElement element)
 54        {
 055            string id = default;
 056            string name = default;
 057            string type = default;
 058            string location = default;
 059            IDictionary<string, string> tags = default;
 060            foreach (var property in element.EnumerateObject())
 61            {
 062                if (property.NameEquals("id"))
 63                {
 064                    if (property.Value.ValueKind == JsonValueKind.Null)
 65                    {
 66                        continue;
 67                    }
 068                    id = property.Value.GetString();
 069                    continue;
 70                }
 071                if (property.NameEquals("name"))
 72                {
 073                    if (property.Value.ValueKind == JsonValueKind.Null)
 74                    {
 75                        continue;
 76                    }
 077                    name = property.Value.GetString();
 078                    continue;
 79                }
 080                if (property.NameEquals("type"))
 81                {
 082                    if (property.Value.ValueKind == JsonValueKind.Null)
 83                    {
 84                        continue;
 85                    }
 086                    type = property.Value.GetString();
 087                    continue;
 88                }
 089                if (property.NameEquals("location"))
 90                {
 091                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 095                    location = property.Value.GetString();
 096                    continue;
 97                }
 098                if (property.NameEquals("tags"))
 99                {
 0100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 0104                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0105                    foreach (var property0 in property.Value.EnumerateObject())
 106                    {
 0107                        if (property0.Value.ValueKind == JsonValueKind.Null)
 108                        {
 0109                            dictionary.Add(property0.Name, null);
 110                        }
 111                        else
 112                        {
 0113                            dictionary.Add(property0.Name, property0.Value.GetString());
 114                        }
 115                    }
 0116                    tags = dictionary;
 117                    continue;
 118                }
 119            }
 0120            return new VM(id, name, type, location, tags);
 121        }
 122    }
 123}