< Summary

Class:Azure.ResourceManager.Compute.Models.TargetRegion
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\TargetRegion.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\TargetRegion.Serialization.cs
Covered lines:43
Uncovered lines:6
Coverable lines:49
Total lines:131
Line coverage:87.7% (43 of 49)
Covered branches:19
Total branches:24
Branch coverage:79.1% (19 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Name()-100%100%
get_RegionalReplicaCount()-100%100%
get_StorageAccountType()-100%100%
get_Encryption()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-85.71%83.33%
DeserializeTargetRegion(...)-85%81.25%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\TargetRegion.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;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> Describes the target region information. </summary>
 13    public partial class TargetRegion
 14    {
 15        /// <summary> Initializes a new instance of TargetRegion. </summary>
 16        /// <param name="name"> The name of the region. </param>
 417        public TargetRegion(string name)
 18        {
 419            if (name == null)
 20            {
 021                throw new ArgumentNullException(nameof(name));
 22            }
 23
 424            Name = name;
 425        }
 26
 27        /// <summary> Initializes a new instance of TargetRegion. </summary>
 28        /// <param name="name"> The name of the region. </param>
 29        /// <param name="regionalReplicaCount"> The number of replicas of the Image Version to be created per region. Th
 30        /// <param name="storageAccountType"> Specifies the storage account type to be used to store the image. This pro
 31        /// <param name="encryption"> Optional. Allows users to provide customer managed keys for encrypting the OS and 
 2432        internal TargetRegion(string name, int? regionalReplicaCount, StorageAccountType? storageAccountType, Encryption
 33        {
 2434            Name = name;
 2435            RegionalReplicaCount = regionalReplicaCount;
 2436            StorageAccountType = storageAccountType;
 2437            Encryption = encryption;
 2438        }
 39
 40        /// <summary> The name of the region. </summary>
 4441        public string Name { get; set; }
 42        /// <summary> The number of replicas of the Image Version to be created per region. This property is updatable. 
 6043        public int? RegionalReplicaCount { get; set; }
 44        /// <summary> Specifies the storage account type to be used to store the image. This property is not updatable. 
 6445        public StorageAccountType? StorageAccountType { get; set; }
 46        /// <summary> Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in th
 4047        public EncryptionImages Encryption { get; set; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\TargetRegion.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    public partial class TargetRegion : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            writer.WritePropertyName("name");
 1619            writer.WriteStringValue(Name);
 1620            if (RegionalReplicaCount != null)
 21            {
 1622                writer.WritePropertyName("regionalReplicaCount");
 1623                writer.WriteNumberValue(RegionalReplicaCount.Value);
 24            }
 1625            if (StorageAccountType != null)
 26            {
 1627                writer.WritePropertyName("storageAccountType");
 1628                writer.WriteStringValue(StorageAccountType.Value.ToString());
 29            }
 1630            if (Encryption != null)
 31            {
 032                writer.WritePropertyName("encryption");
 033                writer.WriteObjectValue(Encryption);
 34            }
 1635            writer.WriteEndObject();
 1636        }
 37
 38        internal static TargetRegion DeserializeTargetRegion(JsonElement element)
 39        {
 2440            string name = default;
 2441            int? regionalReplicaCount = default;
 2442            StorageAccountType? storageAccountType = default;
 2443            EncryptionImages encryption = default;
 19244            foreach (var property in element.EnumerateObject())
 45            {
 7246                if (property.NameEquals("name"))
 47                {
 2448                    name = property.Value.GetString();
 2449                    continue;
 50                }
 4851                if (property.NameEquals("regionalReplicaCount"))
 52                {
 2453                    if (property.Value.ValueKind == JsonValueKind.Null)
 54                    {
 55                        continue;
 56                    }
 2457                    regionalReplicaCount = property.Value.GetInt32();
 2458                    continue;
 59                }
 2460                if (property.NameEquals("storageAccountType"))
 61                {
 2462                    if (property.Value.ValueKind == JsonValueKind.Null)
 63                    {
 64                        continue;
 65                    }
 2466                    storageAccountType = new StorageAccountType(property.Value.GetString());
 2467                    continue;
 68                }
 069                if (property.NameEquals("encryption"))
 70                {
 071                    if (property.Value.ValueKind == JsonValueKind.Null)
 72                    {
 73                        continue;
 74                    }
 075                    encryption = EncryptionImages.DeserializeEncryptionImages(property.Value);
 76                    continue;
 77                }
 78            }
 2479            return new TargetRegion(name, regionalReplicaCount, storageAccountType, encryption);
 80        }
 81    }
 82}