< Summary

Class:Azure.Messaging.EventGrid.SystemEvents.IotHubDeviceCreatedEventData
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceCreatedEventData.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceCreatedEventData.Serialization.cs
Covered lines:15
Uncovered lines:2
Coverable lines:17
Total lines:67
Line coverage:88.2% (15 of 17)
Covered branches:8
Total branches:8
Branch coverage:100% (8 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
DeserializeIotHubDeviceCreatedEventData(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceCreatedEventData.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.DeviceCreated event. </summary>
 11    public partial class IotHubDeviceCreatedEventData : DeviceLifeCycleEventProperties
 12    {
 13        /// <summary> Initializes a new instance of IotHubDeviceCreatedEventData. </summary>
 014        internal IotHubDeviceCreatedEventData()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of IotHubDeviceCreatedEventData. </summary>
 19        /// <param name="deviceId"> The unique identifier of the device. This case-sensitive string can be up to 128 cha
 20        /// <param name="hubName"> Name of the IoT Hub where the device was created or deleted. </param>
 21        /// <param name="twin"> Information about the device twin, which is the cloud representation of application devi
 222        internal IotHubDeviceCreatedEventData(string deviceId, string hubName, DeviceTwinInfo twin) : base(deviceId, hub
 23        {
 224        }
 25    }
 26}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\IotHubDeviceCreatedEventData.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 IotHubDeviceCreatedEventData
 14    {
 15        internal static IotHubDeviceCreatedEventData DeserializeIotHubDeviceCreatedEventData(JsonElement element)
 16        {
 217            Optional<string> deviceId = default;
 218            Optional<string> hubName = default;
 219            Optional<DeviceTwinInfo> twin = default;
 1620            foreach (var property in element.EnumerateObject())
 21            {
 622                if (property.NameEquals("deviceId"))
 23                {
 224                    deviceId = property.Value.GetString();
 225                    continue;
 26                }
 427                if (property.NameEquals("hubName"))
 28                {
 229                    hubName = property.Value.GetString();
 230                    continue;
 31                }
 232                if (property.NameEquals("twin"))
 33                {
 234                    twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value);
 35                    continue;
 36                }
 37            }
 238            return new IotHubDeviceCreatedEventData(deviceId.Value, hubName.Value, twin.Value);
 39        }
 40    }
 41}