< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineAgentInstanceView
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineAgentInstanceView.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineAgentInstanceView.Serialization.cs
Covered lines:45
Uncovered lines:9
Coverable lines:54
Total lines:147
Line coverage:83.3% (45 of 54)
Covered branches:27
Total branches:32
Branch coverage:84.3% (27 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_VmAgentVersion()-100%100%
get_ExtensionHandlers()-100%100%
get_Statuses()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-72.22%70%
DeserializeVirtualMachineAgentInstanceView(...)-92.31%90.91%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineAgentInstanceView.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> The instance view of the VM Agent running on the virtual machine. </summary>
 13    public partial class VirtualMachineAgentInstanceView
 14    {
 15        /// <summary> Initializes a new instance of VirtualMachineAgentInstanceView. </summary>
 016        public VirtualMachineAgentInstanceView()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of VirtualMachineAgentInstanceView. </summary>
 21        /// <param name="vmAgentVersion"> The VM Agent full version. </param>
 22        /// <param name="extensionHandlers"> The virtual machine extension handler instance view. </param>
 23        /// <param name="statuses"> The resource status information. </param>
 19224        internal VirtualMachineAgentInstanceView(string vmAgentVersion, IList<VirtualMachineExtensionHandlerInstanceView
 25        {
 19226            VmAgentVersion = vmAgentVersion;
 19227            ExtensionHandlers = extensionHandlers;
 19228            Statuses = statuses;
 19229        }
 30
 31        /// <summary> The VM Agent full version. </summary>
 22432        public string VmAgentVersion { get; set; }
 33        /// <summary> The virtual machine extension handler instance view. </summary>
 20834        public IList<VirtualMachineExtensionHandlerInstanceView> ExtensionHandlers { get; set; }
 35        /// <summary> The resource status information. </summary>
 22436        public IList<InstanceViewStatus> Statuses { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineAgentInstanceView.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 VirtualMachineAgentInstanceView : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (VmAgentVersion != null)
 20            {
 1621                writer.WritePropertyName("vmAgentVersion");
 1622                writer.WriteStringValue(VmAgentVersion);
 23            }
 1624            if (ExtensionHandlers != null)
 25            {
 026                writer.WritePropertyName("extensionHandlers");
 027                writer.WriteStartArray();
 028                foreach (var item in ExtensionHandlers)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 1634            if (Statuses != null)
 35            {
 1636                writer.WritePropertyName("statuses");
 1637                writer.WriteStartArray();
 6438                foreach (var item in Statuses)
 39                {
 1640                    writer.WriteObjectValue(item);
 41                }
 1642                writer.WriteEndArray();
 43            }
 1644            writer.WriteEndObject();
 1645        }
 46
 47        internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element)
 48        {
 19249            string vmAgentVersion = default;
 19250            IList<VirtualMachineExtensionHandlerInstanceView> extensionHandlers = default;
 19251            IList<InstanceViewStatus> statuses = default;
 120852            foreach (var property in element.EnumerateObject())
 53            {
 41254                if (property.NameEquals("vmAgentVersion"))
 55                {
 19256                    if (property.Value.ValueKind == JsonValueKind.Null)
 57                    {
 58                        continue;
 59                    }
 19260                    vmAgentVersion = property.Value.GetString();
 19261                    continue;
 62                }
 22063                if (property.NameEquals("extensionHandlers"))
 64                {
 2865                    if (property.Value.ValueKind == JsonValueKind.Null)
 66                    {
 67                        continue;
 68                    }
 2869                    List<VirtualMachineExtensionHandlerInstanceView> array = new List<VirtualMachineExtensionHandlerInst
 11270                    foreach (var item in property.Value.EnumerateArray())
 71                    {
 2872                        if (item.ValueKind == JsonValueKind.Null)
 73                        {
 074                            array.Add(null);
 75                        }
 76                        else
 77                        {
 2878                            array.Add(VirtualMachineExtensionHandlerInstanceView.DeserializeVirtualMachineExtensionHandl
 79                        }
 80                    }
 2881                    extensionHandlers = array;
 2882                    continue;
 83                }
 19284                if (property.NameEquals("statuses"))
 85                {
 19286                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 19290                    List<InstanceViewStatus> array = new List<InstanceViewStatus>();
 76891                    foreach (var item in property.Value.EnumerateArray())
 92                    {
 19293                        if (item.ValueKind == JsonValueKind.Null)
 94                        {
 095                            array.Add(null);
 96                        }
 97                        else
 98                        {
 19299                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
 100                        }
 101                    }
 192102                    statuses = array;
 103                    continue;
 104                }
 105            }
 192106            return new VirtualMachineAgentInstanceView(vmAgentVersion, extensionHandlers, statuses);
 107        }
 108    }
 109}