< Summary

Class:Azure.AI.FormRecognizer.Models.FieldData
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\FieldData.cs
Covered lines:4
Uncovered lines:1
Coverable lines:5
Total lines:42
Line coverage:80% (4 of 5)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_FieldElements()-100%100%
op_Implicit(...)-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5
 6namespace Azure.AI.FormRecognizer.Models
 7{
 8    /// <summary>
 9    /// A form element representing text that is part of a <see cref="FormField"/>.
 10    /// This includes the location of the text in the form and a collection of the form
 11    /// elements that make up the text.
 12    /// </summary>
 13    public class FieldData : FormElement
 14    {
 15        /// <summary>
 16        /// </summary>
 17        /// <param name="formElement"></param>
 18        /// <param name="pageNumber"></param>
 19        /// <param name="boundingBox"></param>
 20        /// <param name="text"></param>
 21        internal FieldData(string text, int pageNumber, BoundingBox boundingBox, IReadOnlyList<FormElement> formElement)
 179222            : base(boundingBox, pageNumber, text)
 23        {
 179224            FieldElements = formElement;
 179225        }
 26
 27        /// <summary>
 28        /// When `IncludeFieldElements` is set to <c>true</c>, a list of references to
 29        /// the field elements constituting this <see cref="FieldData"/>. An empty list otherwise. For calls to
 30        /// recognize content, this list is always populated.
 31        /// </summary>
 206432        public IReadOnlyList<FormElement> FieldElements { get; }
 33
 34        /// <summary>
 35        /// Implicitly converts a <see cref="FieldData"/> instance into a <see cref="string"/>, using the
 36        /// value returned by <see cref="FormElement.Text"/>.
 37        /// </summary>
 38        /// <param name="text">The instance to be converted into a <see cref="string"/>.</param>
 39        /// <returns>The <see cref="string"/> corresponding to the recognized text.</returns>
 040        public static implicit operator string(FieldData text) => text.Text;
 41    }
 42}