< Summary

Class:Azure.Messaging.EventGrid.SystemEvents.DeviceLifeCycleEventProperties
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceLifeCycleEventProperties.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceLifeCycleEventProperties.Serialization.cs
Covered lines:6
Uncovered lines:17
Coverable lines:23
Total lines:77
Line coverage:26% (6 of 23)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_DeviceId()-0%100%
get_HubName()-0%100%
get_Twin()-100%100%
DeserializeDeviceLifeCycleEventProperties(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceLifeCycleEventProperties.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> Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, DeviceD
 11    public partial class DeviceLifeCycleEventProperties
 12    {
 13        /// <summary> Initializes a new instance of DeviceLifeCycleEventProperties. </summary>
 014        internal DeviceLifeCycleEventProperties()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of DeviceLifeCycleEventProperties. </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
 422        internal DeviceLifeCycleEventProperties(string deviceId, string hubName, DeviceTwinInfo twin)
 23        {
 424            DeviceId = deviceId;
 425            HubName = hubName;
 426            Twin = twin;
 427        }
 28
 29        /// <summary> The unique identifier of the device. This case-sensitive string can be up to 128 characters long, 
 030        public string DeviceId { get; }
 31        /// <summary> Name of the IoT Hub where the device was created or deleted. </summary>
 032        public string HubName { get; }
 33        /// <summary> Information about the device twin, which is the cloud representation of application device metadat
 434        public DeviceTwinInfo Twin { get; }
 35    }
 36}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceLifeCycleEventProperties.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 DeviceLifeCycleEventProperties
 14    {
 15        internal static DeviceLifeCycleEventProperties DeserializeDeviceLifeCycleEventProperties(JsonElement element)
 16        {
 017            Optional<string> deviceId = default;
 018            Optional<string> hubName = default;
 019            Optional<DeviceTwinInfo> twin = default;
 020            foreach (var property in element.EnumerateObject())
 21            {
 022                if (property.NameEquals("deviceId"))
 23                {
 024                    deviceId = property.Value.GetString();
 025                    continue;
 26                }
 027                if (property.NameEquals("hubName"))
 28                {
 029                    hubName = property.Value.GetString();
 030                    continue;
 31                }
 032                if (property.NameEquals("twin"))
 33                {
 034                    twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value);
 35                    continue;
 36                }
 37            }
 038            return new DeviceLifeCycleEventProperties(deviceId.Value, hubName.Value, twin.Value);
 39        }
 40    }
 41}