< Summary

Class:Azure.ResourceManager.Compute.Models.DedicatedHostGroup
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostGroup.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostGroup.Serialization.cs
Covered lines:77
Uncovered lines:31
Coverable lines:108
Total lines:254
Line coverage:71.2% (77 of 108)
Covered branches:49
Total branches:70
Branch coverage:70% (49 of 70)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Zones()-100%100%
get_PlatformFaultDomainCount()-100%100%
get_Hosts()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-56.41%55%
DeserializeDedicatedHostGroup(...)-77.19%77.08%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostGroup.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> Specifies information about the dedicated host group that the dedicated hosts should be assigned to. &
 14    public partial class DedicatedHostGroup : Resource
 15    {
 16        /// <summary> Initializes a new instance of DedicatedHostGroup. </summary>
 17        /// <param name="location"> Resource location. </param>
 418        public DedicatedHostGroup(string location) : base(location)
 19        {
 420            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 424        }
 25
 26        /// <summary> Initializes a new instance of DedicatedHostGroup. </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="zones"> Availability Zone to use for this host group. Only single zone is supported. The zone c
 33        /// <param name="platformFaultDomainCount"> Number of fault domains that the host group can span. </param>
 34        /// <param name="hosts"> A list of references to all dedicated hosts in the dedicated host group. </param>
 2435        internal DedicatedHostGroup(string id, string name, string type, string location, IDictionary<string, string> ta
 36        {
 2437            Zones = zones;
 2438            PlatformFaultDomainCount = platformFaultDomainCount;
 2439            Hosts = hosts;
 2440        }
 41
 42        /// <summary> Availability Zone to use for this host group. Only single zone is supported. The zone can be assig
 3643        public IList<string> Zones { get; set; }
 44        /// <summary> Number of fault domains that the host group can span. </summary>
 4045        public int? PlatformFaultDomainCount { get; set; }
 46        /// <summary> A list of references to all dedicated hosts in the dedicated host group. </summary>
 3647        public IList<SubResourceReadOnly> Hosts { get; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DedicatedHostGroup.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 DedicatedHostGroup : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Zones != null)
 20            {
 421                writer.WritePropertyName("zones");
 422                writer.WriteStartArray();
 1623                foreach (var item in Zones)
 24                {
 425                    writer.WriteStringValue(item);
 26                }
 427                writer.WriteEndArray();
 28            }
 429            if (Id != null)
 30            {
 031                writer.WritePropertyName("id");
 032                writer.WriteStringValue(Id);
 33            }
 434            if (Name != null)
 35            {
 036                writer.WritePropertyName("name");
 037                writer.WriteStringValue(Name);
 38            }
 439            if (Type != null)
 40            {
 041                writer.WritePropertyName("type");
 042                writer.WriteStringValue(Type);
 43            }
 444            writer.WritePropertyName("location");
 445            writer.WriteStringValue(Location);
 446            if (Tags != null)
 47            {
 048                writer.WritePropertyName("tags");
 049                writer.WriteStartObject();
 050                foreach (var item in Tags)
 51                {
 052                    writer.WritePropertyName(item.Key);
 053                    writer.WriteStringValue(item.Value);
 54                }
 055                writer.WriteEndObject();
 56            }
 457            writer.WritePropertyName("properties");
 458            writer.WriteStartObject();
 459            if (PlatformFaultDomainCount != null)
 60            {
 461                writer.WritePropertyName("platformFaultDomainCount");
 462                writer.WriteNumberValue(PlatformFaultDomainCount.Value);
 63            }
 464            if (Hosts != null)
 65            {
 066                writer.WritePropertyName("hosts");
 067                writer.WriteStartArray();
 068                foreach (var item in Hosts)
 69                {
 070                    writer.WriteObjectValue(item);
 71                }
 072                writer.WriteEndArray();
 73            }
 474            writer.WriteEndObject();
 475            writer.WriteEndObject();
 476        }
 77
 78        internal static DedicatedHostGroup DeserializeDedicatedHostGroup(JsonElement element)
 79        {
 2480            IList<string> zones = default;
 2481            string id = default;
 2482            string name = default;
 2483            string type = default;
 2484            string location = default;
 2485            IDictionary<string, string> tags = default;
 2486            int? platformFaultDomainCount = default;
 2487            IList<SubResourceReadOnly> hosts = default;
 32088            foreach (var property in element.EnumerateObject())
 89            {
 13690                if (property.NameEquals("zones"))
 91                {
 2492                    if (property.Value.ValueKind == JsonValueKind.Null)
 93                    {
 94                        continue;
 95                    }
 2496                    List<string> array = new List<string>();
 9697                    foreach (var item in property.Value.EnumerateArray())
 98                    {
 2499                        if (item.ValueKind == JsonValueKind.Null)
 100                        {
 0101                            array.Add(null);
 102                        }
 103                        else
 104                        {
 24105                            array.Add(item.GetString());
 106                        }
 107                    }
 24108                    zones = array;
 24109                    continue;
 110                }
 112111                if (property.NameEquals("id"))
 112                {
 24113                    if (property.Value.ValueKind == JsonValueKind.Null)
 114                    {
 115                        continue;
 116                    }
 24117                    id = property.Value.GetString();
 24118                    continue;
 119                }
 88120                if (property.NameEquals("name"))
 121                {
 24122                    if (property.Value.ValueKind == JsonValueKind.Null)
 123                    {
 124                        continue;
 125                    }
 24126                    name = property.Value.GetString();
 24127                    continue;
 128                }
 64129                if (property.NameEquals("type"))
 130                {
 0131                    if (property.Value.ValueKind == JsonValueKind.Null)
 132                    {
 133                        continue;
 134                    }
 0135                    type = property.Value.GetString();
 0136                    continue;
 137                }
 64138                if (property.NameEquals("location"))
 139                {
 24140                    location = property.Value.GetString();
 24141                    continue;
 142                }
 40143                if (property.NameEquals("tags"))
 144                {
 16145                    if (property.Value.ValueKind == JsonValueKind.Null)
 146                    {
 147                        continue;
 148                    }
 16149                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 64150                    foreach (var property0 in property.Value.EnumerateObject())
 151                    {
 16152                        if (property0.Value.ValueKind == JsonValueKind.Null)
 153                        {
 0154                            dictionary.Add(property0.Name, null);
 155                        }
 156                        else
 157                        {
 16158                            dictionary.Add(property0.Name, property0.Value.GetString());
 159                        }
 160                    }
 16161                    tags = dictionary;
 16162                    continue;
 163                }
 24164                if (property.NameEquals("properties"))
 165                {
 96166                    foreach (var property0 in property.Value.EnumerateObject())
 167                    {
 24168                        if (property0.NameEquals("platformFaultDomainCount"))
 169                        {
 24170                            if (property0.Value.ValueKind == JsonValueKind.Null)
 171                            {
 172                                continue;
 173                            }
 24174                            platformFaultDomainCount = property0.Value.GetInt32();
 24175                            continue;
 176                        }
 0177                        if (property0.NameEquals("hosts"))
 178                        {
 0179                            if (property0.Value.ValueKind == JsonValueKind.Null)
 180                            {
 181                                continue;
 182                            }
 0183                            List<SubResourceReadOnly> array = new List<SubResourceReadOnly>();
 0184                            foreach (var item in property0.Value.EnumerateArray())
 185                            {
 0186                                if (item.ValueKind == JsonValueKind.Null)
 187                                {
 0188                                    array.Add(null);
 189                                }
 190                                else
 191                                {
 0192                                    array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item));
 193                                }
 194                            }
 0195                            hosts = array;
 196                            continue;
 197                        }
 198                    }
 199                    continue;
 200                }
 201            }
 24202            return new DedicatedHostGroup(id, name, type, location, tags, zones, platformFaultDomainCount, hosts);
 203        }
 204    }
 205}