< Summary

Class:Azure.ResourceManager.Compute.Models.DedicatedHostInstanceView
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostInstanceView.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostInstanceView.Serialization.cs
Covered lines:25
Uncovered lines:21
Coverable lines:46
Total lines:130
Line coverage:54.3% (25 of 46)
Covered branches:17
Total branches:26
Branch coverage:65.3% (17 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_AssetId()-0%100%
get_AvailableCapacity()-0%100%
get_Statuses()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeDedicatedHostInstanceView(...)-95.24%94.44%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostInstanceView.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 a dedicated host. </summary>
 13    public partial class DedicatedHostInstanceView
 14    {
 15        /// <summary> Initializes a new instance of DedicatedHostInstanceView. </summary>
 016        public DedicatedHostInstanceView()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of DedicatedHostInstanceView. </summary>
 21        /// <param name="assetId"> Specifies the unique id of the dedicated physical machine on which the dedicated host
 22        /// <param name="availableCapacity"> Unutilized capacity of the dedicated host. </param>
 23        /// <param name="statuses"> The resource status information. </param>
 424        internal DedicatedHostInstanceView(string assetId, DedicatedHostAvailableCapacity availableCapacity, IList<Insta
 25        {
 426            AssetId = assetId;
 427            AvailableCapacity = availableCapacity;
 428            Statuses = statuses;
 429        }
 30
 31        /// <summary> Specifies the unique id of the dedicated physical machine on which the dedicated host resides. </s
 032        public string AssetId { get; }
 33        /// <summary> Unutilized capacity of the dedicated host. </summary>
 034        public DedicatedHostAvailableCapacity AvailableCapacity { get; set; }
 35        /// <summary> The resource status information. </summary>
 036        public IList<InstanceViewStatus> Statuses { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostInstanceView.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 DedicatedHostInstanceView : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (AssetId != null)
 20            {
 021                writer.WritePropertyName("assetId");
 022                writer.WriteStringValue(AssetId);
 23            }
 024            if (AvailableCapacity != null)
 25            {
 026                writer.WritePropertyName("availableCapacity");
 027                writer.WriteObjectValue(AvailableCapacity);
 28            }
 029            if (Statuses != null)
 30            {
 031                writer.WritePropertyName("statuses");
 032                writer.WriteStartArray();
 033                foreach (var item in Statuses)
 34                {
 035                    writer.WriteObjectValue(item);
 36                }
 037                writer.WriteEndArray();
 38            }
 039            writer.WriteEndObject();
 040        }
 41
 42        internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(JsonElement element)
 43        {
 444            string assetId = default;
 445            DedicatedHostAvailableCapacity availableCapacity = default;
 446            IList<InstanceViewStatus> statuses = default;
 3247            foreach (var property in element.EnumerateObject())
 48            {
 1249                if (property.NameEquals("assetId"))
 50                {
 451                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 455                    assetId = property.Value.GetString();
 456                    continue;
 57                }
 858                if (property.NameEquals("availableCapacity"))
 59                {
 460                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 464                    availableCapacity = DedicatedHostAvailableCapacity.DeserializeDedicatedHostAvailableCapacity(propert
 465                    continue;
 66                }
 467                if (property.NameEquals("statuses"))
 68                {
 469                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 473                    List<InstanceViewStatus> array = new List<InstanceViewStatus>();
 2474                    foreach (var item in property.Value.EnumerateArray())
 75                    {
 876                        if (item.ValueKind == JsonValueKind.Null)
 77                        {
 078                            array.Add(null);
 79                        }
 80                        else
 81                        {
 882                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
 83                        }
 84                    }
 485                    statuses = array;
 86                    continue;
 87                }
 88            }
 489            return new DedicatedHostInstanceView(assetId, availableCapacity, statuses);
 90        }
 91    }
 92}