< Summary

Class:Azure.Messaging.EventGrid.SystemEvents.DeviceTelemetryEventProperties
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTelemetryEventProperties.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTelemetryEventProperties.Serialization.cs
Covered lines:6
Uncovered lines:25
Coverable lines:31
Total lines:93
Line coverage:19.3% (6 of 31)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Body()-0%100%
get_Properties()-100%100%
get_SystemProperties()-0%100%
DeserializeDeviceTelemetryEventProperties(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTelemetryEventProperties.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.Collections.Generic;
 9using Azure.Core;
 10
 11namespace Azure.Messaging.EventGrid.SystemEvents
 12{
 13    /// <summary> Schema of the Data property of an EventGridEvent for a device telemetry event (DeviceTelemetry). </sum
 14    public partial class DeviceTelemetryEventProperties
 15    {
 16        /// <summary> Initializes a new instance of DeviceTelemetryEventProperties. </summary>
 017        internal DeviceTelemetryEventProperties()
 18        {
 019            Properties = new ChangeTrackingDictionary<string, string>();
 020            SystemProperties = new ChangeTrackingDictionary<string, string>();
 021        }
 22
 23        /// <summary> Initializes a new instance of DeviceTelemetryEventProperties. </summary>
 24        /// <param name="body"> The content of the message from the device. </param>
 25        /// <param name="properties"> Application properties are user-defined strings that can be added to the message. 
 26        /// <param name="systemProperties"> System properties help identify contents and source of the messages. </param
 227        internal DeviceTelemetryEventProperties(object body, IReadOnlyDictionary<string, string> properties, IReadOnlyDi
 28        {
 229            Body = body;
 230            Properties = properties;
 231            SystemProperties = systemProperties;
 232        }
 33
 34        /// <summary> The content of the message from the device. </summary>
 035        public object Body { get; }
 36        /// <summary> Application properties are user-defined strings that can be added to the message. These fields are
 237        public IReadOnlyDictionary<string, string> Properties { get; }
 38        /// <summary> System properties help identify contents and source of the messages. </summary>
 039        public IReadOnlyDictionary<string, string> SystemProperties { get; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTelemetryEventProperties.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Messaging.EventGrid.SystemEvents
 13{
 14    public partial class DeviceTelemetryEventProperties
 15    {
 16        internal static DeviceTelemetryEventProperties DeserializeDeviceTelemetryEventProperties(JsonElement element)
 17        {
 018            Optional<object> body = default;
 019            Optional<IReadOnlyDictionary<string, string>> properties = default;
 020            Optional<IReadOnlyDictionary<string, string>> systemProperties = default;
 021            foreach (var property in element.EnumerateObject())
 22            {
 023                if (property.NameEquals("body"))
 24                {
 025                    body = property.Value.GetObject();
 026                    continue;
 27                }
 028                if (property.NameEquals("properties"))
 29                {
 030                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 031                    foreach (var property0 in property.Value.EnumerateObject())
 32                    {
 033                        dictionary.Add(property0.Name, property0.Value.GetString());
 34                    }
 035                    properties = dictionary;
 036                    continue;
 37                }
 038                if (property.NameEquals("systemProperties"))
 39                {
 040                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 041                    foreach (var property0 in property.Value.EnumerateObject())
 42                    {
 043                        dictionary.Add(property0.Name, property0.Value.GetString());
 44                    }
 045                    systemProperties = dictionary;
 46                    continue;
 47                }
 48            }
 049            return new DeviceTelemetryEventProperties(body.Value, Optional.ToDictionary(properties), Optional.ToDictiona
 50        }
 51    }
 52}