< Summary

Class:Azure.AI.FormRecognizer.Models.Model
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\Model.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\Model.Serialization.cs
Covered lines:21
Uncovered lines:5
Coverable lines:26
Total lines:89
Line coverage:80.7% (21 of 26)
Covered branches:8
Total branches:10
Branch coverage:80% (8 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_ModelInfo()-100%100%
get_Keys()-100%100%
get_TrainResult()-100%100%
DeserializeModel(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\Model.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 Azure.AI.FormRecognizer.Training;
 10
 11namespace Azure.AI.FormRecognizer.Models
 12{
 13    /// <summary> Response to the get custom model operation. </summary>
 14    internal partial class Model
 15    {
 16        /// <summary> Initializes a new instance of Model. </summary>
 17        /// <param name="modelInfo"> Basic custom model information. </param>
 18        /// <exception cref="ArgumentNullException"> <paramref name="modelInfo"/> is null. </exception>
 019        internal Model(CustomFormModelInfo modelInfo)
 20        {
 021            if (modelInfo == null)
 22            {
 023                throw new ArgumentNullException(nameof(modelInfo));
 24            }
 25
 026            ModelInfo = modelInfo;
 027        }
 28
 29        /// <summary> Initializes a new instance of Model. </summary>
 30        /// <param name="modelInfo"> Basic custom model information. </param>
 31        /// <param name="keys"> Keys extracted by the custom model. </param>
 32        /// <param name="trainResult"> Custom model training result. </param>
 106633        internal Model(CustomFormModelInfo modelInfo, KeysResult keys, TrainResult trainResult)
 34        {
 106635            ModelInfo = modelInfo;
 106636            Keys = keys;
 106637            TrainResult = trainResult;
 106638        }
 39
 40        /// <summary> Basic custom model information. </summary>
 262841        public CustomFormModelInfo ModelInfo { get; }
 42        /// <summary> Keys extracted by the custom model. </summary>
 21643        public KeysResult Keys { get; }
 44        /// <summary> Custom model training result. </summary>
 71245        public TrainResult TrainResult { get; }
 46    }
 47}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\Model.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.AI.FormRecognizer.Training;
 10using Azure.Core;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    internal partial class Model
 15    {
 16        internal static Model DeserializeModel(JsonElement element)
 17        {
 106618            CustomFormModelInfo modelInfo = default;
 106619            Optional<KeysResult> keys = default;
 106620            Optional<TrainResult> trainResult = default;
 472021            foreach (var property in element.EnumerateObject())
 22            {
 129423                if (property.NameEquals("modelInfo"))
 24                {
 106625                    modelInfo = CustomFormModelInfo.DeserializeCustomFormModelInfo(property.Value);
 106626                    continue;
 27                }
 22828                if (property.NameEquals("keys"))
 29                {
 8030                    keys = KeysResult.DeserializeKeysResult(property.Value);
 8031                    continue;
 32                }
 14833                if (property.NameEquals("trainResult"))
 34                {
 14835                    trainResult = TrainResult.DeserializeTrainResult(property.Value);
 36                    continue;
 37                }
 38            }
 106639            return new Model(modelInfo, keys.Value, trainResult.Value);
 40        }
 41    }
 42}