< Summary

Class:Azure.AI.FormRecognizer.Training.CustomFormModelField
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\CustomFormModelField.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CustomFormModelField.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CustomFormModelField.Serialization.cs
Covered lines:25
Uncovered lines:4
Coverable lines:29
Total lines:111
Line coverage:86.2% (25 of 29)
Covered branches:9
Total branches:12
Branch coverage:75% (9 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
.ctor(...)-87.5%50%
get_Name()-100%100%
get_Accuracy()-100%100%
get_Label()-100%100%
.ctor(...)-83.33%50%
DeserializeCustomFormModelField(...)-83.33%87.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\CustomFormModelField.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Core;
 5
 6namespace Azure.AI.FormRecognizer.Training
 7{
 8    /// <summary>
 9    /// Represents a field that a model will extract from forms it analyzes. A form field includes
 10    /// a name unique to the submodel, a field label representing the label of the field on the form,
 11    /// and, if a model was trained with training-time labels, an estimated accuracy for recognition
 12    /// of the field.
 13    /// </summary>
 14    [CodeGenModel("FormFieldsReport")]
 15    public partial class CustomFormModelField
 16    {
 248417        internal CustomFormModelField(string name, string label, float? accuracy)
 18        {
 294619            Name = name;
 248420            Label = label;
 294621            Accuracy = accuracy;
 248422        }
 023
 24        /// <summary>
 25        /// Canonical name; uniquely identifies a field within the form.
 46226        /// </summary>
 46227        [CodeGenMember("FieldName")]
 285828        public string Name { get; }
 29
 30        /// <summary>
 31        /// The estimated recognition accuracy for this field.
 32        /// </summary>
 33        [CodeGenMember("Accuracy")]
 113234        public float? Accuracy { get; }
 35
 36        /// <summary>
 37        /// The label of this field on the form.
 38        /// </summary>
 34039        public string Label { get; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CustomFormModelField.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.Training
 11{
 12    /// <summary> Report for a custom model training field. </summary>
 13    public partial class CustomFormModelField
 14    {
 15        /// <summary> Initializes a new instance of CustomFormModelField. </summary>
 16        /// <param name="name"> Training field name. </param>
 17        /// <param name="accuracy"> Estimated extraction accuracy for this field. </param>
 18        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 46219        internal CustomFormModelField(string name, float? accuracy)
 20        {
 46221            if (name == null)
 22            {
 023                throw new ArgumentNullException(nameof(name));
 24            }
 25
 46226            Name = name;
 46227            Accuracy = accuracy;
 46228        }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\CustomFormModelField.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.Training
 12{
 13    public partial class CustomFormModelField
 14    {
 15        internal static CustomFormModelField DeserializeCustomFormModelField(JsonElement element)
 16        {
 92417            string fieldName = default;
 92418            float? accuracy = default;
 554419            foreach (var property in element.EnumerateObject())
 20            {
 184821                if (property.NameEquals("fieldName"))
 22                {
 92423                    fieldName = property.Value.GetString();
 92424                    continue;
 25                }
 92426                if (property.NameEquals("accuracy"))
 27                {
 92428                    if (property.Value.ValueKind == JsonValueKind.Null)
 29                    {
 030                        accuracy = null;
 031                        continue;
 32                    }
 92433                    accuracy = property.Value.GetSingle();
 34                    continue;
 35                }
 36            }
 92437            return new CustomFormModelField(fieldName, accuracy);
 38        }
 39    }
 40}