< Summary

Class:Azure.ResourceManager.Compute.Models.DiskInstanceView
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskInstanceView.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskInstanceView.Serialization.cs
Covered lines:38
Uncovered lines:16
Coverable lines:54
Total lines:147
Line coverage:70.3% (38 of 54)
Covered branches:22
Total branches:32
Branch coverage:68.7% (22 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_EncryptionSettings()-100%100%
get_Statuses()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-72.22%70%
DeserializeDiskInstanceView(...)-65.38%68.18%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskInstanceView.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;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> The instance view of the disk. </summary>
 13    public partial class DiskInstanceView
 14    {
 15        /// <summary> Initializes a new instance of DiskInstanceView. </summary>
 016        public DiskInstanceView()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of DiskInstanceView. </summary>
 21        /// <param name="name"> The disk name. </param>
 22        /// <param name="encryptionSettings"> Specifies the encryption settings for the OS Disk. &lt;br&gt;&lt;br&gt; Mi
 23        /// <param name="statuses"> The resource status information. </param>
 26824        internal DiskInstanceView(string name, IList<DiskEncryptionSettings> encryptionSettings, IList<InstanceViewStatu
 25        {
 26826            Name = name;
 26827            EncryptionSettings = encryptionSettings;
 26828            Statuses = statuses;
 26829        }
 30
 31        /// <summary> The disk name. </summary>
 35232        public string Name { get; set; }
 33        /// <summary> Specifies the encryption settings for the OS Disk. &lt;br&gt;&lt;br&gt; Minimum api-version: 2015-
 30034        public IList<DiskEncryptionSettings> EncryptionSettings { get; set; }
 35        /// <summary> The resource status information. </summary>
 40436        public IList<InstanceViewStatus> Statuses { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskInstanceView.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 DiskInstanceView : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 3218            writer.WriteStartObject();
 3219            if (Name != null)
 20            {
 3221                writer.WritePropertyName("name");
 3222                writer.WriteStringValue(Name);
 23            }
 3224            if (EncryptionSettings != null)
 25            {
 026                writer.WritePropertyName("encryptionSettings");
 027                writer.WriteStartArray();
 028                foreach (var item in EncryptionSettings)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 3234            if (Statuses != null)
 35            {
 3236                writer.WritePropertyName("statuses");
 3237                writer.WriteStartArray();
 12838                foreach (var item in Statuses)
 39                {
 3240                    writer.WriteObjectValue(item);
 41                }
 3242                writer.WriteEndArray();
 43            }
 3244            writer.WriteEndObject();
 3245        }
 46
 47        internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element)
 48        {
 26849            string name = default;
 26850            IList<DiskEncryptionSettings> encryptionSettings = default;
 26851            IList<InstanceViewStatus> statuses = default;
 160852            foreach (var property in element.EnumerateObject())
 53            {
 53654                if (property.NameEquals("name"))
 55                {
 26856                    if (property.Value.ValueKind == JsonValueKind.Null)
 57                    {
 58                        continue;
 59                    }
 26860                    name = property.Value.GetString();
 26861                    continue;
 62                }
 26863                if (property.NameEquals("encryptionSettings"))
 64                {
 065                    if (property.Value.ValueKind == JsonValueKind.Null)
 66                    {
 67                        continue;
 68                    }
 069                    List<DiskEncryptionSettings> array = new List<DiskEncryptionSettings>();
 070                    foreach (var item in property.Value.EnumerateArray())
 71                    {
 072                        if (item.ValueKind == JsonValueKind.Null)
 73                        {
 074                            array.Add(null);
 75                        }
 76                        else
 77                        {
 078                            array.Add(DiskEncryptionSettings.DeserializeDiskEncryptionSettings(item));
 79                        }
 80                    }
 081                    encryptionSettings = array;
 082                    continue;
 83                }
 26884                if (property.NameEquals("statuses"))
 85                {
 26886                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 26890                    List<InstanceViewStatus> array = new List<InstanceViewStatus>();
 107291                    foreach (var item in property.Value.EnumerateArray())
 92                    {
 26893                        if (item.ValueKind == JsonValueKind.Null)
 94                        {
 095                            array.Add(null);
 96                        }
 97                        else
 98                        {
 26899                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
 100                        }
 101                    }
 268102                    statuses = array;
 103                    continue;
 104                }
 105            }
 268106            return new DiskInstanceView(name, encryptionSettings, statuses);
 107        }
 108    }
 109}