< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_MethodName()-0%100%
get_Payload()-0%100%
get_ResponseTimeoutInSeconds()-0%100%
get_ConnectTimeoutInSeconds()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeCloudToDeviceMethodRequest(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\CloudToDeviceMethodRequest.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.Iot.Hub.Service.Models
 9{
 10    /// <summary> The parameters to execute a direct method on the device. </summary>
 11    public partial class CloudToDeviceMethodRequest
 12    {
 13        /// <summary> Initializes a new instance of CloudToDeviceMethodRequest. </summary>
 014        public CloudToDeviceMethodRequest()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of CloudToDeviceMethodRequest. </summary>
 19        /// <param name="methodName"> The name of the method to execute. </param>
 20        /// <param name="payload"> The JSON-formatted direct method payload, up to 128kb in size. </param>
 21        /// <param name="responseTimeoutInSeconds"> . </param>
 22        /// <param name="connectTimeoutInSeconds"> . </param>
 023        internal CloudToDeviceMethodRequest(string methodName, object payload, int? responseTimeoutInSeconds, int? conne
 24        {
 025            MethodName = methodName;
 026            Payload = payload;
 027            ResponseTimeoutInSeconds = responseTimeoutInSeconds;
 028            ConnectTimeoutInSeconds = connectTimeoutInSeconds;
 029        }
 30
 31        /// <summary> The name of the method to execute. </summary>
 032        public string MethodName { get; set; }
 33        /// <summary> The JSON-formatted direct method payload, up to 128kb in size. </summary>
 034        public object Payload { get; set; }
 035        public int? ResponseTimeoutInSeconds { get; set; }
 036        public int? ConnectTimeoutInSeconds { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\Generated\Models\CloudToDeviceMethodRequest.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.Iot.Hub.Service.Models
 12{
 13    public partial class CloudToDeviceMethodRequest : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Optional.IsDefined(MethodName))
 19            {
 020                writer.WritePropertyName("methodName");
 021                writer.WriteStringValue(MethodName);
 22            }
 023            if (Optional.IsDefined(Payload))
 24            {
 025                writer.WritePropertyName("payload");
 026                writer.WriteObjectValue(Payload);
 27            }
 028            if (Optional.IsDefined(ResponseTimeoutInSeconds))
 29            {
 030                writer.WritePropertyName("responseTimeoutInSeconds");
 031                writer.WriteNumberValue(ResponseTimeoutInSeconds.Value);
 32            }
 033            if (Optional.IsDefined(ConnectTimeoutInSeconds))
 34            {
 035                writer.WritePropertyName("connectTimeoutInSeconds");
 036                writer.WriteNumberValue(ConnectTimeoutInSeconds.Value);
 37            }
 038            writer.WriteEndObject();
 039        }
 40
 41        internal static CloudToDeviceMethodRequest DeserializeCloudToDeviceMethodRequest(JsonElement element)
 42        {
 043            Optional<string> methodName = default;
 044            Optional<object> payload = default;
 045            Optional<int> responseTimeoutInSeconds = default;
 046            Optional<int> connectTimeoutInSeconds = default;
 047            foreach (var property in element.EnumerateObject())
 48            {
 049                if (property.NameEquals("methodName"))
 50                {
 051                    methodName = property.Value.GetString();
 052                    continue;
 53                }
 054                if (property.NameEquals("payload"))
 55                {
 056                    payload = property.Value.GetObject();
 057                    continue;
 58                }
 059                if (property.NameEquals("responseTimeoutInSeconds"))
 60                {
 061                    responseTimeoutInSeconds = property.Value.GetInt32();
 062                    continue;
 63                }
 064                if (property.NameEquals("connectTimeoutInSeconds"))
 65                {
 066                    connectTimeoutInSeconds = property.Value.GetInt32();
 67                    continue;
 68                }
 69            }
 070            return new CloudToDeviceMethodRequest(methodName.Value, payload.Value, Optional.ToNullable(responseTimeoutIn
 71        }
 72    }
 73}