< Summary

Class:Azure.Messaging.EventGrid.SystemEvents.DeviceTwinProperties
Assembly:Azure.Messaging.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTwinProperties.cs
C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTwinProperties.Serialization.cs
Covered lines:10
Uncovered lines:7
Coverable lines:17
Total lines:67
Line coverage:58.8% (10 of 17)
Covered branches:4
Total branches:6
Branch coverage:66.6% (4 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Metadata()-0%100%
get_Version()-0%100%
DeserializeDeviceTwinProperties(...)-66.67%66.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTwinProperties.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> A portion of the properties that can be written only by the application back-end, and read by the devi
 11    public partial class DeviceTwinProperties
 12    {
 13        /// <summary> Initializes a new instance of DeviceTwinProperties. </summary>
 014        internal DeviceTwinProperties()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of DeviceTwinProperties. </summary>
 19        /// <param name="metadata"> Metadata information for the properties JSON document. </param>
 20        /// <param name="version"> Version of device twin properties. </param>
 821        internal DeviceTwinProperties(DeviceTwinMetadata metadata, float? version)
 22        {
 823            Metadata = metadata;
 824            Version = version;
 825        }
 26
 27        /// <summary> Metadata information for the properties JSON document. </summary>
 028        public DeviceTwinMetadata Metadata { get; }
 29        /// <summary> Version of device twin properties. </summary>
 030        public float? Version { get; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Generated\Models\DeviceTwinProperties.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 DeviceTwinProperties
 14    {
 15        internal static DeviceTwinProperties DeserializeDeviceTwinProperties(JsonElement element)
 16        {
 817            Optional<DeviceTwinMetadata> metadata = default;
 818            Optional<float> version = default;
 4819            foreach (var property in element.EnumerateObject())
 20            {
 1621                if (property.NameEquals("metadata"))
 22                {
 023                    metadata = DeviceTwinMetadata.DeserializeDeviceTwinMetadata(property.Value);
 024                    continue;
 25                }
 1626                if (property.NameEquals("version"))
 27                {
 028                    version = property.Value.GetSingle();
 29                    continue;
 30                }
 31            }
 832            return new DeviceTwinProperties(metadata.Value, Optional.ToNullable(version));
 33        }
 34    }
 35}