< Summary

Class:Azure.ResourceManager.Compute.Models.ProximityPlacementGroup
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ProximityPlacementGroup.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ProximityPlacementGroup.Serialization.cs
Covered lines:99
Uncovered lines:37
Coverable lines:136
Total lines:309
Line coverage:72.7% (99 of 136)
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_ProximityPlacementGroupType()-100%100%
get_VirtualMachines()-100%100%
get_VirtualMachineScaleSets()-100%100%
get_AvailabilitySets()-100%100%
get_ColocationStatus()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-52.08%50%
DeserializeProximityPlacementGroup(...)-81.94%81.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ProximityPlacementGroup.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 proximity placement group. </summary>
 14    public partial class ProximityPlacementGroup : Resource
 15    {
 16        /// <summary> Initializes a new instance of ProximityPlacementGroup. </summary>
 17        /// <param name="location"> Resource location. </param>
 418        public ProximityPlacementGroup(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 ProximityPlacementGroup. </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="proximityPlacementGroupType"> Specifies the type of the proximity placement group. &lt;br&gt;&l
 33        /// <param name="virtualMachines"> A list of references to all virtual machines in the proximity placement group
 34        /// <param name="virtualMachineScaleSets"> A list of references to all virtual machine scale sets in the proximi
 35        /// <param name="availabilitySets"> A list of references to all availability sets in the proximity placement gro
 36        /// <param name="colocationStatus"> Describes colocation status of the Proximity Placement Group. </param>
 837        internal ProximityPlacementGroup(string id, string name, string type, string location, IDictionary<string, strin
 38        {
 839            ProximityPlacementGroupType = proximityPlacementGroupType;
 840            VirtualMachines = virtualMachines;
 841            VirtualMachineScaleSets = virtualMachineScaleSets;
 842            AvailabilitySets = availabilitySets;
 843            ColocationStatus = colocationStatus;
 844        }
 45
 46        /// <summary> Specifies the type of the proximity placement group. &lt;br&gt;&lt;br&gt; Possible values are: &lt
 2047        public ProximityPlacementGroupType? ProximityPlacementGroupType { get; set; }
 48        /// <summary> A list of references to all virtual machines in the proximity placement group. </summary>
 449        public IList<SubResourceWithColocationStatus> VirtualMachines { get; }
 50        /// <summary> A list of references to all virtual machine scale sets in the proximity placement group. </summary
 1251        public IList<SubResourceWithColocationStatus> VirtualMachineScaleSets { get; }
 52        /// <summary> A list of references to all availability sets in the proximity placement group. </summary>
 453        public IList<SubResourceWithColocationStatus> AvailabilitySets { get; }
 54        /// <summary> Describes colocation status of the Proximity Placement Group. </summary>
 1255        public InstanceViewStatus ColocationStatus { get; set; }
 56    }
 57}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ProximityPlacementGroup.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 ProximityPlacementGroup : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 424            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 429            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 434            writer.WritePropertyName("location");
 435            writer.WriteStringValue(Location);
 436            if (Tags != null)
 37            {
 438                writer.WritePropertyName("tags");
 439                writer.WriteStartObject();
 2440                foreach (var item in Tags)
 41                {
 842                    writer.WritePropertyName(item.Key);
 843                    writer.WriteStringValue(item.Value);
 44                }
 445                writer.WriteEndObject();
 46            }
 447            writer.WritePropertyName("properties");
 448            writer.WriteStartObject();
 449            if (ProximityPlacementGroupType != null)
 50            {
 451                writer.WritePropertyName("proximityPlacementGroupType");
 452                writer.WriteStringValue(ProximityPlacementGroupType.Value.ToString());
 53            }
 454            if (VirtualMachines != null)
 55            {
 056                writer.WritePropertyName("virtualMachines");
 057                writer.WriteStartArray();
 058                foreach (var item in VirtualMachines)
 59                {
 060                    writer.WriteObjectValue(item);
 61                }
 062                writer.WriteEndArray();
 63            }
 464            if (VirtualMachineScaleSets != null)
 65            {
 066                writer.WritePropertyName("virtualMachineScaleSets");
 067                writer.WriteStartArray();
 068                foreach (var item in VirtualMachineScaleSets)
 69                {
 070                    writer.WriteObjectValue(item);
 71                }
 072                writer.WriteEndArray();
 73            }
 474            if (AvailabilitySets != null)
 75            {
 076                writer.WritePropertyName("availabilitySets");
 077                writer.WriteStartArray();
 078                foreach (var item in AvailabilitySets)
 79                {
 080                    writer.WriteObjectValue(item);
 81                }
 082                writer.WriteEndArray();
 83            }
 484            if (ColocationStatus != null)
 85            {
 086                writer.WritePropertyName("colocationStatus");
 087                writer.WriteObjectValue(ColocationStatus);
 88            }
 489            writer.WriteEndObject();
 490            writer.WriteEndObject();
 491        }
 92
 93        internal static ProximityPlacementGroup DeserializeProximityPlacementGroup(JsonElement element)
 94        {
 895            string id = default;
 896            string name = default;
 897            string type = default;
 898            string location = default;
 899            IDictionary<string, string> tags = default;
 8100            ProximityPlacementGroupType? proximityPlacementGroupType = default;
 8101            IList<SubResourceWithColocationStatus> virtualMachines = default;
 8102            IList<SubResourceWithColocationStatus> virtualMachineScaleSets = default;
 8103            IList<SubResourceWithColocationStatus> availabilitySets = default;
 8104            InstanceViewStatus colocationStatus = default;
 112105            foreach (var property in element.EnumerateObject())
 106            {
 48107                if (property.NameEquals("id"))
 108                {
 8109                    if (property.Value.ValueKind == JsonValueKind.Null)
 110                    {
 111                        continue;
 112                    }
 8113                    id = property.Value.GetString();
 8114                    continue;
 115                }
 40116                if (property.NameEquals("name"))
 117                {
 8118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 8122                    name = property.Value.GetString();
 8123                    continue;
 124                }
 32125                if (property.NameEquals("type"))
 126                {
 8127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 8131                    type = property.Value.GetString();
 8132                    continue;
 133                }
 24134                if (property.NameEquals("location"))
 135                {
 8136                    location = property.Value.GetString();
 8137                    continue;
 138                }
 16139                if (property.NameEquals("tags"))
 140                {
 8141                    if (property.Value.ValueKind == JsonValueKind.Null)
 142                    {
 143                        continue;
 144                    }
 8145                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 48146                    foreach (var property0 in property.Value.EnumerateObject())
 147                    {
 16148                        if (property0.Value.ValueKind == JsonValueKind.Null)
 149                        {
 0150                            dictionary.Add(property0.Name, null);
 151                        }
 152                        else
 153                        {
 16154                            dictionary.Add(property0.Name, property0.Value.GetString());
 155                        }
 156                    }
 8157                    tags = dictionary;
 8158                    continue;
 159                }
 8160                if (property.NameEquals("properties"))
 161                {
 56162                    foreach (var property0 in property.Value.EnumerateObject())
 163                    {
 20164                        if (property0.NameEquals("proximityPlacementGroupType"))
 165                        {
 8166                            if (property0.Value.ValueKind == JsonValueKind.Null)
 167                            {
 168                                continue;
 169                            }
 8170                            proximityPlacementGroupType = new ProximityPlacementGroupType(property0.Value.GetString());
 8171                            continue;
 172                        }
 12173                        if (property0.NameEquals("virtualMachines"))
 174                        {
 4175                            if (property0.Value.ValueKind == JsonValueKind.Null)
 176                            {
 177                                continue;
 178                            }
 4179                            List<SubResourceWithColocationStatus> array = new List<SubResourceWithColocationStatus>();
 0180                            foreach (var item in property0.Value.EnumerateArray())
 181                            {
 0182                                if (item.ValueKind == JsonValueKind.Null)
 183                                {
 0184                                    array.Add(null);
 185                                }
 186                                else
 187                                {
 0188                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus
 189                                }
 190                            }
 4191                            virtualMachines = array;
 4192                            continue;
 193                        }
 8194                        if (property0.NameEquals("virtualMachineScaleSets"))
 195                        {
 4196                            if (property0.Value.ValueKind == JsonValueKind.Null)
 197                            {
 198                                continue;
 199                            }
 4200                            List<SubResourceWithColocationStatus> array = new List<SubResourceWithColocationStatus>();
 16201                            foreach (var item in property0.Value.EnumerateArray())
 202                            {
 4203                                if (item.ValueKind == JsonValueKind.Null)
 204                                {
 0205                                    array.Add(null);
 206                                }
 207                                else
 208                                {
 4209                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus
 210                                }
 211                            }
 4212                            virtualMachineScaleSets = array;
 4213                            continue;
 214                        }
 4215                        if (property0.NameEquals("availabilitySets"))
 216                        {
 4217                            if (property0.Value.ValueKind == JsonValueKind.Null)
 218                            {
 219                                continue;
 220                            }
 4221                            List<SubResourceWithColocationStatus> array = new List<SubResourceWithColocationStatus>();
 0222                            foreach (var item in property0.Value.EnumerateArray())
 223                            {
 0224                                if (item.ValueKind == JsonValueKind.Null)
 225                                {
 0226                                    array.Add(null);
 227                                }
 228                                else
 229                                {
 0230                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus
 231                                }
 232                            }
 4233                            availabilitySets = array;
 4234                            continue;
 235                        }
 0236                        if (property0.NameEquals("colocationStatus"))
 237                        {
 0238                            if (property0.Value.ValueKind == JsonValueKind.Null)
 239                            {
 240                                continue;
 241                            }
 0242                            colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property0.Value);
 243                            continue;
 244                        }
 245                    }
 246                    continue;
 247                }
 248            }
 8249            return new ProximityPlacementGroup(id, name, type, location, tags, proximityPlacementGroupType, virtualMachi
 250        }
 251    }
 252}