< Summary

Class:Azure.ResourceManager.Compute.Models.ImageDiskReference
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDiskReference.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDiskReference.Serialization.cs
Covered lines:11
Uncovered lines:18
Coverable lines:29
Total lines:93
Line coverage:37.9% (11 of 29)
Covered branches:5
Total branches:12
Branch coverage:41.6% (5 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Id()-0%100%
get_Lun()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeImageDiskReference(...)-70%62.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDiskReference.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> The source image used for creating the disk. </summary>
 13    public partial class ImageDiskReference
 14    {
 15        /// <summary> Initializes a new instance of ImageDiskReference. </summary>
 16        /// <param name="id"> A relative uri containing either a Platform Image Repository or user image reference. </pa
 017        public ImageDiskReference(string id)
 18        {
 019            if (id == null)
 20            {
 021                throw new ArgumentNullException(nameof(id));
 22            }
 23
 024            Id = id;
 025        }
 26
 27        /// <summary> Initializes a new instance of ImageDiskReference. </summary>
 28        /// <param name="id"> A relative uri containing either a Platform Image Repository or user image reference. </pa
 29        /// <param name="lun"> If the disk is created from an image&apos;s data disk, this is an index that indicates wh
 430        internal ImageDiskReference(string id, int? lun)
 31        {
 432            Id = id;
 433            Lun = lun;
 434        }
 35
 36        /// <summary> A relative uri containing either a Platform Image Repository or user image reference. </summary>
 037        public string Id { get; set; }
 38        /// <summary> If the disk is created from an image&apos;s data disk, this is an index that indicates which of th
 039        public int? Lun { get; set; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDiskReference.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 ImageDiskReference : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("id");
 019            writer.WriteStringValue(Id);
 020            if (Lun != null)
 21            {
 022                writer.WritePropertyName("lun");
 023                writer.WriteNumberValue(Lun.Value);
 24            }
 025            writer.WriteEndObject();
 026        }
 27
 28        internal static ImageDiskReference DeserializeImageDiskReference(JsonElement element)
 29        {
 430            string id = default;
 431            int? lun = default;
 1632            foreach (var property in element.EnumerateObject())
 33            {
 434                if (property.NameEquals("id"))
 35                {
 436                    id = property.Value.GetString();
 437                    continue;
 38                }
 039                if (property.NameEquals("lun"))
 40                {
 041                    if (property.Value.ValueKind == JsonValueKind.Null)
 42                    {
 43                        continue;
 44                    }
 045                    lun = property.Value.GetInt32();
 46                    continue;
 47                }
 48            }
 449            return new ImageDiskReference(id, lun);
 50        }
 51    }
 52}