< Summary

Class:Azure.AI.FormRecognizer.Models.TextLine
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextLine.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextLine.Serialization.cs
Covered lines:30
Uncovered lines:14
Coverable lines:44
Total lines:122
Line coverage:68.1% (30 of 44)
Covered branches:13
Total branches:20
Branch coverage:65% (13 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Language()-0%100%
get_Words()-100%100%
DeserializeTextLine(...)-91.3%92.86%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextLine.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 System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    /// <summary> An object representing an extracted text line. </summary>
 15    internal partial class TextLine
 16    {
 17        /// <summary> Initializes a new instance of TextLine. </summary>
 18        /// <param name="text"> The text content of the line. </param>
 19        /// <param name="boundingBox"> Bounding box of an extracted line. </param>
 20        /// <param name="words"> List of words in the text line. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="text"/>, <paramref name="boundingBox"/>, or <paramr
 022        internal TextLine(string text, IEnumerable<float> boundingBox, IEnumerable<TextWord> words)
 23        {
 024            if (text == null)
 25            {
 026                throw new ArgumentNullException(nameof(text));
 27            }
 028            if (boundingBox == null)
 29            {
 030                throw new ArgumentNullException(nameof(boundingBox));
 31            }
 032            if (words == null)
 33            {
 034                throw new ArgumentNullException(nameof(words));
 35            }
 36
 037            Text = text;
 038            BoundingBox = boundingBox.ToList();
 039            Words = words.ToList();
 040        }
 41
 42        /// <summary> Initializes a new instance of TextLine. </summary>
 43        /// <param name="text"> The text content of the line. </param>
 44        /// <param name="boundingBox"> Bounding box of an extracted line. </param>
 45        /// <param name="language"> The detected language of this line, if different from the overall page language. </p
 46        /// <param name="words"> List of words in the text line. </param>
 493647        internal TextLine(string text, IReadOnlyList<float> boundingBox, Language? language, IReadOnlyList<TextWord> wor
 48        {
 493649            Text = text;
 493650            BoundingBox = boundingBox;
 493651            Language = language;
 493652            Words = words;
 493653        }
 54
 55        /// <summary> The text content of the line. </summary>
 493656        public string Text { get; }
 57        /// <summary> Bounding box of an extracted line. </summary>
 493658        public IReadOnlyList<float> BoundingBox { get; }
 59        /// <summary> The detected language of this line, if different from the overall page language. </summary>
 060        public Language? Language { get; }
 61        /// <summary> List of words in the text line. </summary>
 1024462        public IReadOnlyList<TextWord> Words { get; }
 63    }
 64}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextLine.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    internal partial class TextLine
 15    {
 16        internal static TextLine DeserializeTextLine(JsonElement element)
 17        {
 493618            string text = default;
 493619            IReadOnlyList<float> boundingBox = default;
 493620            Optional<Language> language = default;
 493621            IReadOnlyList<TextWord> words = default;
 3948822            foreach (var property in element.EnumerateObject())
 23            {
 1480824                if (property.NameEquals("text"))
 25                {
 493626                    text = property.Value.GetString();
 493627                    continue;
 28                }
 987229                if (property.NameEquals("boundingBox"))
 30                {
 493631                    List<float> array = new List<float>();
 8884832                    foreach (var item in property.Value.EnumerateArray())
 33                    {
 3948834                        array.Add(item.GetSingle());
 35                    }
 493636                    boundingBox = array;
 493637                    continue;
 38                }
 493639                if (property.NameEquals("language"))
 40                {
 041                    language = new Language(property.Value.GetString());
 042                    continue;
 43                }
 493644                if (property.NameEquals("words"))
 45                {
 493646                    List<TextWord> array = new List<TextWord>();
 3107247                    foreach (var item in property.Value.EnumerateArray())
 48                    {
 1060049                        array.Add(TextWord.DeserializeTextWord(item));
 50                    }
 493651                    words = array;
 52                    continue;
 53                }
 54            }
 493655            return new TextLine(text, boundingBox, Optional.ToNullable(language), words);
 56        }
 57    }
 58}