< Summary

Class:Azure.ResourceManager.Resources.Models.WhatIfChange
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\WhatIfChange.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\WhatIfChange.Serialization.cs
Covered lines:40
Uncovered lines:7
Coverable lines:47
Total lines:134
Line coverage:85.1% (40 of 47)
Covered branches:21
Total branches:24
Branch coverage:87.5% (21 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_ResourceId()-100%100%
get_ChangeType()-100%100%
get_Before()-100%100%
get_After()-100%100%
get_Delta()-100%100%
DeserializeWhatIfChange(...)-96.55%95.45%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\WhatIfChange.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.Resources.Models
 12{
 13    /// <summary> Information about a single resource change predicted by What-If operation. </summary>
 14    public partial class WhatIfChange
 15    {
 16        /// <summary> Initializes a new instance of WhatIfChange. </summary>
 17        /// <param name="resourceId"> Resource ID. </param>
 18        /// <param name="changeType"> Type of change that will be made to the resource when the deployment is executed. 
 019        internal WhatIfChange(string resourceId, ChangeType changeType)
 20        {
 021            if (resourceId == null)
 22            {
 023                throw new ArgumentNullException(nameof(resourceId));
 24            }
 25
 026            ResourceId = resourceId;
 027            ChangeType = changeType;
 028        }
 29
 30        /// <summary> Initializes a new instance of WhatIfChange. </summary>
 31        /// <param name="resourceId"> Resource ID. </param>
 32        /// <param name="changeType"> Type of change that will be made to the resource when the deployment is executed. 
 33        /// <param name="before"> The snapshot of the resource before the deployment is executed. </param>
 34        /// <param name="after"> The predicted snapshot of the resource after the deployment is executed. </param>
 35        /// <param name="delta"> The predicted changes to resource properties. </param>
 6436        internal WhatIfChange(string resourceId, ChangeType changeType, object before, object after, IReadOnlyList<WhatI
 37        {
 6438            ResourceId = resourceId;
 6439            ChangeType = changeType;
 6440            Before = before;
 6441            After = after;
 6442            Delta = delta;
 6443        }
 44
 45        /// <summary> Resource ID. </summary>
 5246        public string ResourceId { get; }
 47        /// <summary> Type of change that will be made to the resource when the deployment is executed. </summary>
 7048        public ChangeType ChangeType { get; }
 49        /// <summary> The snapshot of the resource before the deployment is executed. </summary>
 2450        public object Before { get; }
 51        /// <summary> The predicted snapshot of the resource after the deployment is executed. </summary>
 2852        public object After { get; }
 53        /// <summary> The predicted changes to resource properties. </summary>
 6054        public IReadOnlyList<WhatIfPropertyChange> Delta { get; }
 55    }
 56}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\WhatIfChange.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.Resources.Models
 13{
 14    public partial class WhatIfChange
 15    {
 16        internal static WhatIfChange DeserializeWhatIfChange(JsonElement element)
 17        {
 6418            string resourceId = default;
 6419            ChangeType changeType = default;
 6420            object before = default;
 6421            object after = default;
 6422            IReadOnlyList<WhatIfPropertyChange> delta = default;
 52023            foreach (var property in element.EnumerateObject())
 24            {
 19625                if (property.NameEquals("resourceId"))
 26                {
 6427                    resourceId = property.Value.GetString();
 6428                    continue;
 29                }
 13230                if (property.NameEquals("changeType"))
 31                {
 6432                    changeType = property.Value.GetString().ToChangeType();
 6433                    continue;
 34                }
 6835                if (property.NameEquals("before"))
 36                {
 2437                    if (property.Value.ValueKind == JsonValueKind.Null)
 38                    {
 39                        continue;
 40                    }
 2441                    before = property.Value.GetObject();
 2442                    continue;
 43                }
 4444                if (property.NameEquals("after"))
 45                {
 2846                    if (property.Value.ValueKind == JsonValueKind.Null)
 47                    {
 48                        continue;
 49                    }
 2850                    after = property.Value.GetObject();
 2851                    continue;
 52                }
 1653                if (property.NameEquals("delta"))
 54                {
 1655                    if (property.Value.ValueKind == JsonValueKind.Null)
 56                    {
 57                        continue;
 58                    }
 1659                    List<WhatIfPropertyChange> array = new List<WhatIfPropertyChange>();
 7260                    foreach (var item in property.Value.EnumerateArray())
 61                    {
 2062                        if (item.ValueKind == JsonValueKind.Null)
 63                        {
 064                            array.Add(null);
 65                        }
 66                        else
 67                        {
 2068                            array.Add(WhatIfPropertyChange.DeserializeWhatIfPropertyChange(item));
 69                        }
 70                    }
 1671                    delta = array;
 72                    continue;
 73                }
 74            }
 6475            return new WhatIfChange(resourceId, changeType, before, after, delta);
 76        }
 77    }
 78}