< Summary

Class:Azure.Iot.Hub.Service.Models.ModuleIdentity
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\ModuleIdentity.cs
C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\ModuleIdentity.Serialization.cs
Covered lines:98
Uncovered lines:0
Coverable lines:98
Total lines:205
Line coverage:100% (98 of 98)
Covered branches:42
Total branches:42
Branch coverage:100% (42 of 42)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_ModuleId()-100%100%
get_ManagedBy()-100%100%
get_DeviceId()-100%100%
get_GenerationId()-100%100%
get_Etag()-100%100%
get_ConnectionState()-100%100%
get_ConnectionStateUpdatedTime()-100%100%
get_LastActivityTime()-100%100%
get_CloudToDeviceMessageCount()-100%100%
get_Authentication()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeModuleIdentity(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\ModuleIdentity.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.Iot.Hub.Service.Models
 11{
 12    /// <summary> The module identity on a device. </summary>
 13    public partial class ModuleIdentity
 14    {
 15        /// <summary> Initializes a new instance of ModuleIdentity. </summary>
 23616        public ModuleIdentity()
 17        {
 23618        }
 19
 20        /// <summary> Initializes a new instance of ModuleIdentity. </summary>
 21        /// <param name="moduleId"> The unique identifier of the module. </param>
 22        /// <param name="managedBy"> Identifies who manages this module. For instance, this value is \&quot;IotEdge\&quo
 23        /// <param name="deviceId"> The unique identifier of the device. </param>
 24        /// <param name="generationId"> The IoT Hub generated, case-sensitive string up to 128 characters long. This val
 25        /// <param name="etag"> The string representing a weak ETag for the module identity, as per RFC7232. </param>
 26        /// <param name="connectionState"> The connection state of the device. </param>
 27        /// <param name="connectionStateUpdatedTime"> The date and time the connection state was last updated. </param>
 28        /// <param name="lastActivityTime"> The date and time the device last connected, received, or sent a message. </
 29        /// <param name="cloudToDeviceMessageCount"> The number of cloud-to-module messages currently queued to be sent 
 30        /// <param name="authentication"> . </param>
 15231        internal ModuleIdentity(string moduleId, string managedBy, string deviceId, string generationId, string etag, Mo
 32        {
 15233            ModuleId = moduleId;
 15234            ManagedBy = managedBy;
 15235            DeviceId = deviceId;
 15236            GenerationId = generationId;
 15237            Etag = etag;
 15238            ConnectionState = connectionState;
 15239            ConnectionStateUpdatedTime = connectionStateUpdatedTime;
 15240            LastActivityTime = lastActivityTime;
 15241            CloudToDeviceMessageCount = cloudToDeviceMessageCount;
 15242            Authentication = authentication;
 15243        }
 44
 45        /// <summary> The unique identifier of the module. </summary>
 97246        public string ModuleId { get; set; }
 47        /// <summary> Identifies who manages this module. For instance, this value is \&quot;IotEdge\&quot; if the edge 
 28048        public string ManagedBy { get; set; }
 49        /// <summary> The unique identifier of the device. </summary>
 167250        public string DeviceId { get; set; }
 51        /// <summary> The IoT Hub generated, case-sensitive string up to 128 characters long. This value is used to dist
 26052        public string GenerationId { get; set; }
 53        /// <summary> The string representing a weak ETag for the module identity, as per RFC7232. </summary>
 36854        public string Etag { get; set; }
 55        /// <summary> The connection state of the device. </summary>
 26056        public ModuleConnectionState? ConnectionState { get; set; }
 57        /// <summary> The date and time the connection state was last updated. </summary>
 26058        public DateTimeOffset? ConnectionStateUpdatedTime { get; set; }
 59        /// <summary> The date and time the device last connected, received, or sent a message. </summary>
 26060        public DateTimeOffset? LastActivityTime { get; set; }
 61        /// <summary> The number of cloud-to-module messages currently queued to be sent to the module. </summary>
 26062        public int? CloudToDeviceMessageCount { get; set; }
 62063        public AuthenticationMechanism Authentication { get; set; }
 64    }
 65}

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\ModuleIdentity.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;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Iot.Hub.Service.Models
 13{
 14    public partial class ModuleIdentity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 9218            writer.WriteStartObject();
 9219            if (Optional.IsDefined(ModuleId))
 20            {
 9221                writer.WritePropertyName("moduleId");
 9222                writer.WriteStringValue(ModuleId);
 23            }
 9224            if (Optional.IsDefined(ManagedBy))
 25            {
 1626                writer.WritePropertyName("managedBy");
 1627                writer.WriteStringValue(ManagedBy);
 28            }
 9229            if (Optional.IsDefined(DeviceId))
 30            {
 9231                writer.WritePropertyName("deviceId");
 9232                writer.WriteStringValue(DeviceId);
 33            }
 9234            if (Optional.IsDefined(GenerationId))
 35            {
 1636                writer.WritePropertyName("generationId");
 1637                writer.WriteStringValue(GenerationId);
 38            }
 9239            if (Optional.IsDefined(Etag))
 40            {
 1641                writer.WritePropertyName("etag");
 1642                writer.WriteStringValue(Etag);
 43            }
 9244            if (Optional.IsDefined(ConnectionState))
 45            {
 1646                writer.WritePropertyName("connectionState");
 1647                writer.WriteStringValue(ConnectionState.Value.ToString());
 48            }
 9249            if (Optional.IsDefined(ConnectionStateUpdatedTime))
 50            {
 1651                writer.WritePropertyName("connectionStateUpdatedTime");
 1652                writer.WriteStringValue(ConnectionStateUpdatedTime.Value, "O");
 53            }
 9254            if (Optional.IsDefined(LastActivityTime))
 55            {
 1656                writer.WritePropertyName("lastActivityTime");
 1657                writer.WriteStringValue(LastActivityTime.Value, "O");
 58            }
 9259            if (Optional.IsDefined(CloudToDeviceMessageCount))
 60            {
 1661                writer.WritePropertyName("cloudToDeviceMessageCount");
 1662                writer.WriteNumberValue(CloudToDeviceMessageCount.Value);
 63            }
 9264            if (Optional.IsDefined(Authentication))
 65            {
 5666                writer.WritePropertyName("authentication");
 5667                writer.WriteObjectValue(Authentication);
 68            }
 9269            writer.WriteEndObject();
 9270        }
 71
 72        internal static ModuleIdentity DeserializeModuleIdentity(JsonElement element)
 73        {
 15274            Optional<string> moduleId = default;
 15275            Optional<string> managedBy = default;
 15276            Optional<string> deviceId = default;
 15277            Optional<string> generationId = default;
 15278            Optional<string> etag = default;
 15279            Optional<ModuleConnectionState> connectionState = default;
 15280            Optional<DateTimeOffset> connectionStateUpdatedTime = default;
 15281            Optional<DateTimeOffset> lastActivityTime = default;
 15282            Optional<int> cloudToDeviceMessageCount = default;
 15283            Optional<AuthenticationMechanism> authentication = default;
 334484            foreach (var property in element.EnumerateObject())
 85            {
 152086                if (property.NameEquals("moduleId"))
 87                {
 15288                    moduleId = property.Value.GetString();
 15289                    continue;
 90                }
 136891                if (property.NameEquals("managedBy"))
 92                {
 15293                    managedBy = property.Value.GetString();
 15294                    continue;
 95                }
 121696                if (property.NameEquals("deviceId"))
 97                {
 15298                    deviceId = property.Value.GetString();
 15299                    continue;
 100                }
 1064101                if (property.NameEquals("generationId"))
 102                {
 152103                    generationId = property.Value.GetString();
 152104                    continue;
 105                }
 912106                if (property.NameEquals("etag"))
 107                {
 152108                    etag = property.Value.GetString();
 152109                    continue;
 110                }
 760111                if (property.NameEquals("connectionState"))
 112                {
 152113                    connectionState = new ModuleConnectionState(property.Value.GetString());
 152114                    continue;
 115                }
 608116                if (property.NameEquals("connectionStateUpdatedTime"))
 117                {
 152118                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
 152119                    continue;
 120                }
 456121                if (property.NameEquals("lastActivityTime"))
 122                {
 152123                    lastActivityTime = property.Value.GetDateTimeOffset("O");
 152124                    continue;
 125                }
 304126                if (property.NameEquals("cloudToDeviceMessageCount"))
 127                {
 152128                    cloudToDeviceMessageCount = property.Value.GetInt32();
 152129                    continue;
 130                }
 152131                if (property.NameEquals("authentication"))
 132                {
 152133                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
 134                    continue;
 135                }
 136            }
 152137            return new ModuleIdentity(moduleId.Value, managedBy.Value, deviceId.Value, generationId.Value, etag.Value, O
 138        }
 139    }
 140}