< Summary

Class:Azure.Iot.Hub.Service.Models.TwinConfiguration
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\TwinConfiguration.cs
C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\TwinConfiguration.Serialization.cs
Covered lines:0
Uncovered lines:115
Coverable lines:115
Total lines:236
Line coverage:0% (0 of 115)
Covered branches:0
Total branches:50
Branch coverage:0% (0 of 50)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Id()-0%100%
get_SchemaVersion()-0%100%
get_Labels()-0%100%
get_Content()-0%100%
get_TargetCondition()-0%100%
get_CreatedTimeUtc()-0%100%
get_LastUpdatedTimeUtc()-0%100%
get_Priority()-0%100%
get_SystemMetrics()-0%100%
get_Metrics()-0%100%
get_Etag()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeTwinConfiguration(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\TwinConfiguration.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;
 9using System.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.Iot.Hub.Service.Models
 13{
 14    /// <summary> The configuration for Iot Hub device and module twins. </summary>
 15    public partial class TwinConfiguration
 16    {
 17        /// <summary> Initializes a new instance of TwinConfiguration. </summary>
 018        public TwinConfiguration()
 19        {
 020            Labels = new ChangeTrackingDictionary<string, string>();
 021        }
 22
 23        /// <summary> Initializes a new instance of TwinConfiguration. </summary>
 24        /// <param name="id"> The unique identifier of the configuration. </param>
 25        /// <param name="schemaVersion"> The schema version of the configuration. </param>
 26        /// <param name="labels"> The key-value pairs used to describe the configuration. </param>
 27        /// <param name="content"> The content of the configuration. </param>
 28        /// <param name="targetCondition"> The query used to define the targeted devices or modules. The query is based 
 29        /// <param name="createdTimeUtc"> The creation date and time of the configuration. </param>
 30        /// <param name="lastUpdatedTimeUtc"> The update date and time of the configuration. </param>
 31        /// <param name="priority"> The priority number assigned to the configuration. </param>
 32        /// <param name="systemMetrics"> The system metrics computed by the IoT Hub that cannot be customized. </param>
 33        /// <param name="metrics"> The custom metrics specified by the developer as queries against twin reported proper
 34        /// <param name="etag"> The ETag of the configuration. </param>
 035        internal TwinConfiguration(string id, string schemaVersion, IDictionary<string, string> labels, ConfigurationCon
 36        {
 037            Id = id;
 038            SchemaVersion = schemaVersion;
 039            Labels = labels;
 040            Content = content;
 041            TargetCondition = targetCondition;
 042            CreatedTimeUtc = createdTimeUtc;
 043            LastUpdatedTimeUtc = lastUpdatedTimeUtc;
 044            Priority = priority;
 045            SystemMetrics = systemMetrics;
 046            Metrics = metrics;
 047            Etag = etag;
 048        }
 49
 50        /// <summary> The unique identifier of the configuration. </summary>
 051        public string Id { get; set; }
 52        /// <summary> The schema version of the configuration. </summary>
 053        public string SchemaVersion { get; set; }
 54        /// <summary> The key-value pairs used to describe the configuration. </summary>
 055        public IDictionary<string, string> Labels { get; }
 56        /// <summary> The content of the configuration. </summary>
 057        public ConfigurationContent Content { get; set; }
 58        /// <summary> The query used to define the targeted devices or modules. The query is based on twin tags and/or r
 059        public string TargetCondition { get; set; }
 60        /// <summary> The creation date and time of the configuration. </summary>
 061        public DateTimeOffset? CreatedTimeUtc { get; set; }
 62        /// <summary> The update date and time of the configuration. </summary>
 063        public DateTimeOffset? LastUpdatedTimeUtc { get; set; }
 64        /// <summary> The priority number assigned to the configuration. </summary>
 065        public int? Priority { get; set; }
 66        /// <summary> The system metrics computed by the IoT Hub that cannot be customized. </summary>
 067        public ConfigurationMetrics SystemMetrics { get; set; }
 68        /// <summary> The custom metrics specified by the developer as queries against twin reported properties. </summa
 069        public ConfigurationMetrics Metrics { get; set; }
 70        /// <summary> The ETag of the configuration. </summary>
 071        public string Etag { get; set; }
 72    }
 73}

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\TwinConfiguration.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.Iot.Hub.Service.Models
 14{
 15    public partial class TwinConfiguration : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            if (Optional.IsDefined(Id))
 21            {
 022                writer.WritePropertyName("id");
 023                writer.WriteStringValue(Id);
 24            }
 025            if (Optional.IsDefined(SchemaVersion))
 26            {
 027                writer.WritePropertyName("schemaVersion");
 028                writer.WriteStringValue(SchemaVersion);
 29            }
 030            if (Optional.IsCollectionDefined(Labels))
 31            {
 032                writer.WritePropertyName("labels");
 033                writer.WriteStartObject();
 034                foreach (var item in Labels)
 35                {
 036                    writer.WritePropertyName(item.Key);
 037                    writer.WriteStringValue(item.Value);
 38                }
 039                writer.WriteEndObject();
 40            }
 041            if (Optional.IsDefined(Content))
 42            {
 043                writer.WritePropertyName("content");
 044                writer.WriteObjectValue(Content);
 45            }
 046            if (Optional.IsDefined(TargetCondition))
 47            {
 048                writer.WritePropertyName("targetCondition");
 049                writer.WriteStringValue(TargetCondition);
 50            }
 051            if (Optional.IsDefined(CreatedTimeUtc))
 52            {
 053                writer.WritePropertyName("createdTimeUtc");
 054                writer.WriteStringValue(CreatedTimeUtc.Value, "O");
 55            }
 056            if (Optional.IsDefined(LastUpdatedTimeUtc))
 57            {
 058                writer.WritePropertyName("lastUpdatedTimeUtc");
 059                writer.WriteStringValue(LastUpdatedTimeUtc.Value, "O");
 60            }
 061            if (Optional.IsDefined(Priority))
 62            {
 063                writer.WritePropertyName("priority");
 064                writer.WriteNumberValue(Priority.Value);
 65            }
 066            if (Optional.IsDefined(SystemMetrics))
 67            {
 068                writer.WritePropertyName("systemMetrics");
 069                writer.WriteObjectValue(SystemMetrics);
 70            }
 071            if (Optional.IsDefined(Metrics))
 72            {
 073                writer.WritePropertyName("metrics");
 074                writer.WriteObjectValue(Metrics);
 75            }
 076            if (Optional.IsDefined(Etag))
 77            {
 078                writer.WritePropertyName("etag");
 079                writer.WriteStringValue(Etag);
 80            }
 081            writer.WriteEndObject();
 082        }
 83
 84        internal static TwinConfiguration DeserializeTwinConfiguration(JsonElement element)
 85        {
 086            Optional<string> id = default;
 087            Optional<string> schemaVersion = default;
 088            Optional<IDictionary<string, string>> labels = default;
 089            Optional<ConfigurationContent> content = default;
 090            Optional<string> targetCondition = default;
 091            Optional<DateTimeOffset> createdTimeUtc = default;
 092            Optional<DateTimeOffset> lastUpdatedTimeUtc = default;
 093            Optional<int> priority = default;
 094            Optional<ConfigurationMetrics> systemMetrics = default;
 095            Optional<ConfigurationMetrics> metrics = default;
 096            Optional<string> etag = default;
 097            foreach (var property in element.EnumerateObject())
 98            {
 099                if (property.NameEquals("id"))
 100                {
 0101                    id = property.Value.GetString();
 0102                    continue;
 103                }
 0104                if (property.NameEquals("schemaVersion"))
 105                {
 0106                    schemaVersion = property.Value.GetString();
 0107                    continue;
 108                }
 0109                if (property.NameEquals("labels"))
 110                {
 0111                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0112                    foreach (var property0 in property.Value.EnumerateObject())
 113                    {
 0114                        dictionary.Add(property0.Name, property0.Value.GetString());
 115                    }
 0116                    labels = dictionary;
 0117                    continue;
 118                }
 0119                if (property.NameEquals("content"))
 120                {
 0121                    content = ConfigurationContent.DeserializeConfigurationContent(property.Value);
 0122                    continue;
 123                }
 0124                if (property.NameEquals("targetCondition"))
 125                {
 0126                    targetCondition = property.Value.GetString();
 0127                    continue;
 128                }
 0129                if (property.NameEquals("createdTimeUtc"))
 130                {
 0131                    createdTimeUtc = property.Value.GetDateTimeOffset("O");
 0132                    continue;
 133                }
 0134                if (property.NameEquals("lastUpdatedTimeUtc"))
 135                {
 0136                    lastUpdatedTimeUtc = property.Value.GetDateTimeOffset("O");
 0137                    continue;
 138                }
 0139                if (property.NameEquals("priority"))
 140                {
 0141                    priority = property.Value.GetInt32();
 0142                    continue;
 143                }
 0144                if (property.NameEquals("systemMetrics"))
 145                {
 0146                    systemMetrics = ConfigurationMetrics.DeserializeConfigurationMetrics(property.Value);
 0147                    continue;
 148                }
 0149                if (property.NameEquals("metrics"))
 150                {
 0151                    metrics = ConfigurationMetrics.DeserializeConfigurationMetrics(property.Value);
 0152                    continue;
 153                }
 0154                if (property.NameEquals("etag"))
 155                {
 0156                    etag = property.Value.GetString();
 157                    continue;
 158                }
 159            }
 0160            return new TwinConfiguration(id.Value, schemaVersion.Value, Optional.ToDictionary(labels), content.Value, ta
 161        }
 162    }
 163}