< Summary

Class:Azure.ResourceManager.Compute.Models.AvailabilitySet
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\AvailabilitySet.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\AvailabilitySet.Serialization.cs
Covered lines:102
Uncovered lines:36
Coverable lines:138
Total lines:311
Line coverage:73.9% (102 of 138)
Covered branches:63
Total branches:88
Branch coverage:71.5% (63 of 88)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Sku()-100%100%
get_PlatformUpdateDomainCount()-100%100%
get_PlatformFaultDomainCount()-100%100%
get_VirtualMachines()-100%100%
get_ProximityPlacementGroup()-100%100%
get_Statuses()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-62.5%61.54%
DeserializeAvailabilitySet(...)-76.39%76.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\AvailabilitySet.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 availability set that the virtual machine should be assigned to. Virtu
 14    public partial class AvailabilitySet : Resource
 15    {
 16        /// <summary> Initializes a new instance of AvailabilitySet. </summary>
 17        /// <param name="location"> Resource location. </param>
 13618        public AvailabilitySet(string location) : base(location)
 19        {
 13620            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 13624        }
 25
 26        /// <summary> Initializes a new instance of AvailabilitySet. </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="sku"> Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes
 33        /// <param name="platformUpdateDomainCount"> Update Domain count. </param>
 34        /// <param name="platformFaultDomainCount"> Fault Domain count. </param>
 35        /// <param name="virtualMachines"> A list of references to all virtual machines in the availability set. </param
 36        /// <param name="proximityPlacementGroup"> Specifies information about the proximity placement group that the av
 37        /// <param name="statuses"> The resource status information. </param>
 18038        internal AvailabilitySet(string id, string name, string type, string location, IDictionary<string, string> tags,
 39        {
 18040            Sku = sku;
 18041            PlatformUpdateDomainCount = platformUpdateDomainCount;
 18042            PlatformFaultDomainCount = platformFaultDomainCount;
 18043            VirtualMachines = virtualMachines;
 18044            ProximityPlacementGroup = proximityPlacementGroup;
 18045            Statuses = statuses;
 18046        }
 47
 48        /// <summary> Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for poss
 56049        public Sku Sku { get; set; }
 50        /// <summary> Update Domain count. </summary>
 62051        public int? PlatformUpdateDomainCount { get; set; }
 52        /// <summary> Fault Domain count. </summary>
 62853        public int? PlatformFaultDomainCount { get; set; }
 54        /// <summary> A list of references to all virtual machines in the availability set. </summary>
 35655        public IList<SubResource> VirtualMachines { get; set; }
 56        /// <summary> Specifies information about the proximity placement group that the availability set should be assi
 32857        public SubResource ProximityPlacementGroup { get; set; }
 58        /// <summary> The resource status information. </summary>
 14859        public IList<InstanceViewStatus> Statuses { get; }
 60    }
 61}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\AvailabilitySet.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 AvailabilitySet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 14818            writer.WriteStartObject();
 14819            if (Sku != null)
 20            {
 11621                writer.WritePropertyName("sku");
 11622                writer.WriteObjectValue(Sku);
 23            }
 14824            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 14829            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 14834            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 14839            writer.WritePropertyName("location");
 14840            writer.WriteStringValue(Location);
 14841            if (Tags != null)
 42            {
 14843                writer.WritePropertyName("tags");
 14844                writer.WriteStartObject();
 88845                foreach (var item in Tags)
 46                {
 29647                    writer.WritePropertyName(item.Key);
 29648                    writer.WriteStringValue(item.Value);
 49                }
 14850                writer.WriteEndObject();
 51            }
 14852            writer.WritePropertyName("properties");
 14853            writer.WriteStartObject();
 14854            if (PlatformUpdateDomainCount != null)
 55            {
 12856                writer.WritePropertyName("platformUpdateDomainCount");
 12857                writer.WriteNumberValue(PlatformUpdateDomainCount.Value);
 58            }
 14859            if (PlatformFaultDomainCount != null)
 60            {
 13661                writer.WritePropertyName("platformFaultDomainCount");
 13662                writer.WriteNumberValue(PlatformFaultDomainCount.Value);
 63            }
 14864            if (VirtualMachines != null)
 65            {
 066                writer.WritePropertyName("virtualMachines");
 067                writer.WriteStartArray();
 068                foreach (var item in VirtualMachines)
 69                {
 070                    writer.WriteObjectValue(item);
 71                }
 072                writer.WriteEndArray();
 73            }
 14874            if (ProximityPlacementGroup != null)
 75            {
 076                writer.WritePropertyName("proximityPlacementGroup");
 077                writer.WriteObjectValue(ProximityPlacementGroup);
 78            }
 14879            if (Statuses != null)
 80            {
 081                writer.WritePropertyName("statuses");
 082                writer.WriteStartArray();
 083                foreach (var item in Statuses)
 84                {
 085                    writer.WriteObjectValue(item);
 86                }
 087                writer.WriteEndArray();
 88            }
 14889            writer.WriteEndObject();
 14890            writer.WriteEndObject();
 14891        }
 92
 93        internal static AvailabilitySet DeserializeAvailabilitySet(JsonElement element)
 94        {
 18095            Sku sku = default;
 18096            string id = default;
 18097            string name = default;
 18098            string type = default;
 18099            string location = default;
 180100            IDictionary<string, string> tags = default;
 180101            int? platformUpdateDomainCount = default;
 180102            int? platformFaultDomainCount = default;
 180103            IList<SubResource> virtualMachines = default;
 180104            SubResource proximityPlacementGroup = default;
 180105            IList<InstanceViewStatus> statuses = default;
 2880106            foreach (var property in element.EnumerateObject())
 107            {
 1260108                if (property.NameEquals("sku"))
 109                {
 180110                    if (property.Value.ValueKind == JsonValueKind.Null)
 111                    {
 112                        continue;
 113                    }
 180114                    sku = Sku.DeserializeSku(property.Value);
 180115                    continue;
 116                }
 1080117                if (property.NameEquals("id"))
 118                {
 180119                    if (property.Value.ValueKind == JsonValueKind.Null)
 120                    {
 121                        continue;
 122                    }
 180123                    id = property.Value.GetString();
 180124                    continue;
 125                }
 900126                if (property.NameEquals("name"))
 127                {
 180128                    if (property.Value.ValueKind == JsonValueKind.Null)
 129                    {
 130                        continue;
 131                    }
 180132                    name = property.Value.GetString();
 180133                    continue;
 134                }
 720135                if (property.NameEquals("type"))
 136                {
 180137                    if (property.Value.ValueKind == JsonValueKind.Null)
 138                    {
 139                        continue;
 140                    }
 180141                    type = property.Value.GetString();
 180142                    continue;
 143                }
 540144                if (property.NameEquals("location"))
 145                {
 180146                    location = property.Value.GetString();
 180147                    continue;
 148                }
 360149                if (property.NameEquals("tags"))
 150                {
 180151                    if (property.Value.ValueKind == JsonValueKind.Null)
 152                    {
 153                        continue;
 154                    }
 180155                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 1096156                    foreach (var property0 in property.Value.EnumerateObject())
 157                    {
 368158                        if (property0.Value.ValueKind == JsonValueKind.Null)
 159                        {
 0160                            dictionary.Add(property0.Name, null);
 161                        }
 162                        else
 163                        {
 368164                            dictionary.Add(property0.Name, property0.Value.GetString());
 165                        }
 166                    }
 180167                    tags = dictionary;
 180168                    continue;
 169                }
 180170                if (property.NameEquals("properties"))
 171                {
 1144172                    foreach (var property0 in property.Value.EnumerateObject())
 173                    {
 392174                        if (property0.NameEquals("platformUpdateDomainCount"))
 175                        {
 180176                            if (property0.Value.ValueKind == JsonValueKind.Null)
 177                            {
 178                                continue;
 179                            }
 180180                            platformUpdateDomainCount = property0.Value.GetInt32();
 180181                            continue;
 182                        }
 212183                        if (property0.NameEquals("platformFaultDomainCount"))
 184                        {
 180185                            if (property0.Value.ValueKind == JsonValueKind.Null)
 186                            {
 187                                continue;
 188                            }
 180189                            platformFaultDomainCount = property0.Value.GetInt32();
 180190                            continue;
 191                        }
 32192                        if (property0.NameEquals("virtualMachines"))
 193                        {
 32194                            if (property0.Value.ValueKind == JsonValueKind.Null)
 195                            {
 196                                continue;
 197                            }
 32198                            List<SubResource> array = new List<SubResource>();
 0199                            foreach (var item in property0.Value.EnumerateArray())
 200                            {
 0201                                if (item.ValueKind == JsonValueKind.Null)
 202                                {
 0203                                    array.Add(null);
 204                                }
 205                                else
 206                                {
 0207                                    array.Add(SubResource.DeserializeSubResource(item));
 208                                }
 209                            }
 32210                            virtualMachines = array;
 32211                            continue;
 212                        }
 0213                        if (property0.NameEquals("proximityPlacementGroup"))
 214                        {
 0215                            if (property0.Value.ValueKind == JsonValueKind.Null)
 216                            {
 217                                continue;
 218                            }
 0219                            proximityPlacementGroup = SubResource.DeserializeSubResource(property0.Value);
 0220                            continue;
 221                        }
 0222                        if (property0.NameEquals("statuses"))
 223                        {
 0224                            if (property0.Value.ValueKind == JsonValueKind.Null)
 225                            {
 226                                continue;
 227                            }
 0228                            List<InstanceViewStatus> array = new List<InstanceViewStatus>();
 0229                            foreach (var item in property0.Value.EnumerateArray())
 230                            {
 0231                                if (item.ValueKind == JsonValueKind.Null)
 232                                {
 0233                                    array.Add(null);
 234                                }
 235                                else
 236                                {
 0237                                    array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
 238                                }
 239                            }
 0240                            statuses = array;
 241                            continue;
 242                        }
 243                    }
 244                    continue;
 245                }
 246            }
 180247            return new AvailabilitySet(id, name, type, location, tags, sku, platformUpdateDomainCount, platformFaultDoma
 248        }
 249    }
 250}