< Summary

Class:Azure.ResourceManager.Compute.Models.Encryption
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Encryption.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Encryption.Serialization.cs
Covered lines:12
Uncovered lines:16
Coverable lines:28
Total lines:91
Line coverage:42.8% (12 of 28)
Covered branches:8
Total branches:14
Branch coverage:57.1% (8 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_DiskEncryptionSetId()-0%100%
get_Type()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeEncryption(...)-72.73%80%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Encryption.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> Encryption at rest settings for disk or snapshot. </summary>
 11    public partial class Encryption
 12    {
 13        /// <summary> Initializes a new instance of Encryption. </summary>
 014        public Encryption()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of Encryption. </summary>
 19        /// <param name="diskEncryptionSetId"> ResourceId of the disk encryption set to use for enabling encryption at r
 20        /// <param name="type"> The type of key used to encrypt the data of the disk. </param>
 31621        internal Encryption(string diskEncryptionSetId, EncryptionType? type)
 22        {
 31623            DiskEncryptionSetId = diskEncryptionSetId;
 31624            Type = type;
 31625        }
 26
 27        /// <summary> ResourceId of the disk encryption set to use for enabling encryption at rest. </summary>
 028        public string DiskEncryptionSetId { get; set; }
 29        /// <summary> The type of key used to encrypt the data of the disk. </summary>
 030        public EncryptionType? Type { get; set; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Encryption.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 Encryption : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (DiskEncryptionSetId != null)
 19            {
 020                writer.WritePropertyName("diskEncryptionSetId");
 021                writer.WriteStringValue(DiskEncryptionSetId);
 22            }
 023            if (Type != null)
 24            {
 025                writer.WritePropertyName("type");
 026                writer.WriteStringValue(Type.Value.ToString());
 27            }
 028            writer.WriteEndObject();
 029        }
 30
 31        internal static Encryption DeserializeEncryption(JsonElement element)
 32        {
 31633            string diskEncryptionSetId = default;
 31634            EncryptionType? type = default;
 126435            foreach (var property in element.EnumerateObject())
 36            {
 31637                if (property.NameEquals("diskEncryptionSetId"))
 38                {
 039                    if (property.Value.ValueKind == JsonValueKind.Null)
 40                    {
 41                        continue;
 42                    }
 043                    diskEncryptionSetId = property.Value.GetString();
 044                    continue;
 45                }
 31646                if (property.NameEquals("type"))
 47                {
 31648                    if (property.Value.ValueKind == JsonValueKind.Null)
 49                    {
 50                        continue;
 51                    }
 31652                    type = new EncryptionType(property.Value.GetString());
 53                    continue;
 54                }
 55            }
 31656            return new Encryption(diskEncryptionSetId, type);
 57        }
 58    }
 59}