< Summary

Class:Azure.ResourceManager.Compute.Models.UpgradePolicy
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\UpgradePolicy.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\UpgradePolicy.Serialization.cs
Covered lines:27
Uncovered lines:11
Coverable lines:38
Total lines:110
Line coverage:71% (27 of 38)
Covered branches:12
Total branches:20
Branch coverage:60% (12 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Mode()-100%100%
get_RollingUpgradePolicy()-100%100%
get_AutomaticOSUpgradePolicy()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-66.67%66.67%
DeserializeUpgradePolicy(...)-56.25%57.14%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\UpgradePolicy.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> Describes an upgrade policy - automatic, manual, or rolling. </summary>
 11    public partial class UpgradePolicy
 12    {
 13        /// <summary> Initializes a new instance of UpgradePolicy. </summary>
 17214        public UpgradePolicy()
 15        {
 17216        }
 17
 18        /// <summary> Initializes a new instance of UpgradePolicy. </summary>
 19        /// <param name="mode"> Specifies the mode of an upgrade to virtual machines in the scale set.&lt;br /&gt;&lt;br
 20        /// <param name="rollingUpgradePolicy"> The configuration parameters used while performing a rolling upgrade. </
 21        /// <param name="automaticOSUpgradePolicy"> Configuration parameters used for performing automatic OS Upgrade. <
 44822        internal UpgradePolicy(UpgradeMode? mode, RollingUpgradePolicy rollingUpgradePolicy, AutomaticOSUpgradePolicy au
 23        {
 44824            Mode = mode;
 44825            RollingUpgradePolicy = rollingUpgradePolicy;
 44826            AutomaticOSUpgradePolicy = automaticOSUpgradePolicy;
 44827        }
 28
 29        /// <summary> Specifies the mode of an upgrade to virtual machines in the scale set.&lt;br /&gt;&lt;br /&gt; Pos
 134830        public UpgradeMode? Mode { get; set; }
 31        /// <summary> The configuration parameters used while performing a rolling upgrade. </summary>
 81232        public RollingUpgradePolicy RollingUpgradePolicy { get; set; }
 33        /// <summary> Configuration parameters used for performing automatic OS Upgrade. </summary>
 109634        public AutomaticOSUpgradePolicy AutomaticOSUpgradePolicy { get; set; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\UpgradePolicy.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 UpgradePolicy : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 36417            writer.WriteStartObject();
 36418            if (Mode != null)
 19            {
 36420                writer.WritePropertyName("mode");
 36421                writer.WriteStringValue(Mode.Value.ToSerialString());
 22            }
 36423            if (RollingUpgradePolicy != null)
 24            {
 025                writer.WritePropertyName("rollingUpgradePolicy");
 026                writer.WriteObjectValue(RollingUpgradePolicy);
 27            }
 36428            if (AutomaticOSUpgradePolicy != null)
 29            {
 030                writer.WritePropertyName("automaticOSUpgradePolicy");
 031                writer.WriteObjectValue(AutomaticOSUpgradePolicy);
 32            }
 36433            writer.WriteEndObject();
 36434        }
 35
 36        internal static UpgradePolicy DeserializeUpgradePolicy(JsonElement element)
 37        {
 44838            UpgradeMode? mode = default;
 44839            RollingUpgradePolicy rollingUpgradePolicy = default;
 44840            AutomaticOSUpgradePolicy automaticOSUpgradePolicy = default;
 179241            foreach (var property in element.EnumerateObject())
 42            {
 44843                if (property.NameEquals("mode"))
 44                {
 44845                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 44849                    mode = property.Value.GetString().ToUpgradeMode();
 44850                    continue;
 51                }
 052                if (property.NameEquals("rollingUpgradePolicy"))
 53                {
 054                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 058                    rollingUpgradePolicy = RollingUpgradePolicy.DeserializeRollingUpgradePolicy(property.Value);
 059                    continue;
 60                }
 061                if (property.NameEquals("automaticOSUpgradePolicy"))
 62                {
 063                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 067                    automaticOSUpgradePolicy = AutomaticOSUpgradePolicy.DeserializeAutomaticOSUpgradePolicy(property.Val
 68                    continue;
 69                }
 70            }
 44871            return new UpgradePolicy(mode, rollingUpgradePolicy, automaticOSUpgradePolicy);
 72        }
 73    }
 74}