< Summary

Class:Azure.Iot.Hub.Service.Models.SymmetricKey
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\SymmetricKey.cs
C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\SymmetricKey.Serialization.cs
Covered lines:24
Uncovered lines:2
Coverable lines:26
Total lines:83
Line coverage:92.3% (24 of 26)
Covered branches:10
Total branches:10
Branch coverage:100% (10 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_PrimaryKey()-100%100%
get_SecondaryKey()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeSymmetricKey(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\SymmetricKey.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.Iot.Hub.Service.Models
 9{
 10    /// <summary> The SymmetricKey. </summary>
 11    public partial class SymmetricKey
 12    {
 13        /// <summary> Initializes a new instance of SymmetricKey. </summary>
 014        public SymmetricKey()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of SymmetricKey. </summary>
 19        /// <param name="primaryKey"> The base64 encoded primary key of the device. </param>
 20        /// <param name="secondaryKey"> The base64 encoded secondary key of the device. </param>
 23221        internal SymmetricKey(string primaryKey, string secondaryKey)
 22        {
 23223            PrimaryKey = primaryKey;
 23224            SecondaryKey = secondaryKey;
 23225        }
 26
 27        /// <summary> The base64 encoded primary key of the device. </summary>
 31228        public string PrimaryKey { get; set; }
 29        /// <summary> The base64 encoded secondary key of the device. </summary>
 31230        public string SecondaryKey { get; set; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\SymmetricKey.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.Iot.Hub.Service.Models
 12{
 13    public partial class SymmetricKey : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 4017            writer.WriteStartObject();
 4018            if (Optional.IsDefined(PrimaryKey))
 19            {
 4020                writer.WritePropertyName("primaryKey");
 4021                writer.WriteStringValue(PrimaryKey);
 22            }
 4023            if (Optional.IsDefined(SecondaryKey))
 24            {
 4025                writer.WritePropertyName("secondaryKey");
 4026                writer.WriteStringValue(SecondaryKey);
 27            }
 4028            writer.WriteEndObject();
 4029        }
 30
 31        internal static SymmetricKey DeserializeSymmetricKey(JsonElement element)
 32        {
 23233            Optional<string> primaryKey = default;
 23234            Optional<string> secondaryKey = default;
 139235            foreach (var property in element.EnumerateObject())
 36            {
 46437                if (property.NameEquals("primaryKey"))
 38                {
 23239                    primaryKey = property.Value.GetString();
 23240                    continue;
 41                }
 23242                if (property.NameEquals("secondaryKey"))
 43                {
 23244                    secondaryKey = property.Value.GetString();
 45                    continue;
 46                }
 47            }
 23248            return new SymmetricKey(primaryKey.Value, secondaryKey.Value);
 49        }
 50    }
 51}