< Summary

Class:Azure.Messaging.EventGrid.SystemEvents.IotHubDeviceConnectedEventData
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceConnectedEventData.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceConnectedEventData.Serialization.cs
Covered lines:19
Uncovered lines:2
Coverable lines:21
Total lines:74
Line coverage:90.4% (19 of 21)
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%
DeserializeIotHubDeviceConnectedEventData(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceConnectedEventData.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.Messaging.EventGrid.SystemEvents
 9{
 10    /// <summary> Event data for Microsoft.Devices.DeviceConnected event. </summary>
 11    public partial class IotHubDeviceConnectedEventData : DeviceConnectionStateEventProperties
 12    {
 13        /// <summary> Initializes a new instance of IotHubDeviceConnectedEventData. </summary>
 014        internal IotHubDeviceConnectedEventData()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of IotHubDeviceConnectedEventData. </summary>
 19        /// <param name="deviceId"> The unique identifier of the device. This case-sensitive string can be up to 128 cha
 20        /// <param name="moduleId"> The unique identifier of the module. This case-sensitive string can be up to 128 cha
 21        /// <param name="hubName"> Name of the IoT Hub where the device was created or deleted. </param>
 22        /// <param name="deviceConnectionStateEventInfo"> Information about the device connection state event. </param>
 223        internal IotHubDeviceConnectedEventData(string deviceId, string moduleId, string hubName, DeviceConnectionStateE
 24        {
 225        }
 26    }
 27}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceConnectedEventData.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.Messaging.EventGrid.SystemEvents
 12{
 13    public partial class IotHubDeviceConnectedEventData
 14    {
 15        internal static IotHubDeviceConnectedEventData DeserializeIotHubDeviceConnectedEventData(JsonElement element)
 16        {
 217            Optional<string> deviceId = default;
 218            Optional<string> moduleId = default;
 219            Optional<string> hubName = default;
 220            Optional<DeviceConnectionStateEventInfo> deviceConnectionStateEventInfo = default;
 2021            foreach (var property in element.EnumerateObject())
 22            {
 823                if (property.NameEquals("deviceId"))
 24                {
 225                    deviceId = property.Value.GetString();
 226                    continue;
 27                }
 628                if (property.NameEquals("moduleId"))
 29                {
 230                    moduleId = property.Value.GetString();
 231                    continue;
 32                }
 433                if (property.NameEquals("hubName"))
 34                {
 235                    hubName = property.Value.GetString();
 236                    continue;
 37                }
 238                if (property.NameEquals("deviceConnectionStateEventInfo"))
 39                {
 240                    deviceConnectionStateEventInfo = DeviceConnectionStateEventInfo.DeserializeDeviceConnectionStateEven
 41                    continue;
 42                }
 43            }
 244            return new IotHubDeviceConnectedEventData(deviceId.Value, moduleId.Value, hubName.Value, deviceConnectionSta
 45        }
 46    }
 47}