< Summary

Class:Azure.AI.FormRecognizer.Models.CopyAuthorizationResult
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CopyAuthorizationResult.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CopyAuthorizationResult.Serialization.cs
Covered lines:32
Uncovered lines:2
Coverable lines:34
Total lines:96
Line coverage:94.1% (32 of 34)
Covered branches:10
Total branches:12
Branch coverage:83.3% (10 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-77.78%50%
get_ModelId()-100%100%
get_AccessToken()-100%100%
get_ExpirationDateTimeTicks()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeCopyAuthorizationResult(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CopyAuthorizationResult.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;
 9
 10namespace Azure.AI.FormRecognizer.Models
 11{
 12    /// <summary> Request parameter that contains authorization claims for copy operation. </summary>
 13    internal partial class CopyAuthorizationResult
 14    {
 15        /// <summary> Initializes a new instance of CopyAuthorizationResult. </summary>
 16        /// <param name="modelId"> Model identifier. </param>
 17        /// <param name="accessToken"> Token claim used to authorize the request. </param>
 18        /// <param name="expirationDateTimeTicks"> The time when the access token expires. The date is represented as th
 19        /// <exception cref="ArgumentNullException"> <paramref name="modelId"/> or <paramref name="accessToken"/> is nul
 3220        public CopyAuthorizationResult(string modelId, string accessToken, long expirationDateTimeTicks)
 21        {
 3222            if (modelId == null)
 23            {
 024                throw new ArgumentNullException(nameof(modelId));
 25            }
 3226            if (accessToken == null)
 27            {
 028                throw new ArgumentNullException(nameof(accessToken));
 29            }
 30
 3231            ModelId = modelId;
 3232            AccessToken = accessToken;
 3233            ExpirationDateTimeTicks = expirationDateTimeTicks;
 3234        }
 35
 36        /// <summary> Model identifier. </summary>
 6437        public string ModelId { get; set; }
 38        /// <summary> Token claim used to authorize the request. </summary>
 6439        public string AccessToken { get; set; }
 40        /// <summary> The time when the access token expires. The date is represented as the number of seconds from 1970
 6441        public long ExpirationDateTimeTicks { get; set; }
 42    }
 43}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CopyAuthorizationResult.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.AI.FormRecognizer.Models
 12{
 13    internal partial class CopyAuthorizationResult : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1217            writer.WriteStartObject();
 1218            writer.WritePropertyName("modelId");
 1219            writer.WriteStringValue(ModelId);
 1220            writer.WritePropertyName("accessToken");
 1221            writer.WriteStringValue(AccessToken);
 1222            writer.WritePropertyName("expirationDateTimeTicks");
 1223            writer.WriteNumberValue(ExpirationDateTimeTicks);
 1224            writer.WriteEndObject();
 1225        }
 26
 27        internal static CopyAuthorizationResult DeserializeCopyAuthorizationResult(JsonElement element)
 28        {
 2029            string modelId = default;
 2030            string accessToken = default;
 2031            long expirationDateTimeTicks = default;
 16032            foreach (var property in element.EnumerateObject())
 33            {
 6034                if (property.NameEquals("modelId"))
 35                {
 2036                    modelId = property.Value.GetString();
 2037                    continue;
 38                }
 4039                if (property.NameEquals("accessToken"))
 40                {
 2041                    accessToken = property.Value.GetString();
 2042                    continue;
 43                }
 2044                if (property.NameEquals("expirationDateTimeTicks"))
 45                {
 2046                    expirationDateTimeTicks = property.Value.GetInt64();
 47                    continue;
 48                }
 49            }
 2050            return new CopyAuthorizationResult(modelId, accessToken, expirationDateTimeTicks);
 51        }
 52    }
 53}