< Summary

Class:Azure.AI.FormRecognizer.Models.TextWord
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextWord.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextWord.Serialization.cs
Covered lines:24
Uncovered lines:8
Coverable lines:32
Total lines:101
Line coverage:75% (24 of 32)
Covered branches:10
Total branches:14
Branch coverage:71.4% (10 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Confidence()-100%100%
DeserializeTextWord(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextWord.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 a word. </summary>
 15    internal partial class TextWord
 16    {
 17        /// <summary> Initializes a new instance of TextWord. </summary>
 18        /// <param name="text"> The text content of the word. </param>
 19        /// <param name="boundingBox"> Bounding box of an extracted word. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="text"/> or <paramref name="boundingBox"/> is null. 
 021        internal TextWord(string text, IEnumerable<float> boundingBox)
 22        {
 023            if (text == null)
 24            {
 025                throw new ArgumentNullException(nameof(text));
 26            }
 027            if (boundingBox == null)
 28            {
 029                throw new ArgumentNullException(nameof(boundingBox));
 30            }
 31
 032            Text = text;
 033            BoundingBox = boundingBox.ToList();
 034        }
 35
 36        /// <summary> Initializes a new instance of TextWord. </summary>
 37        /// <param name="text"> The text content of the word. </param>
 38        /// <param name="boundingBox"> Bounding box of an extracted word. </param>
 39        /// <param name="confidence"> Confidence value. </param>
 1060040        internal TextWord(string text, IReadOnlyList<float> boundingBox, float? confidence)
 41        {
 1060042            Text = text;
 1060043            BoundingBox = boundingBox;
 1060044            Confidence = confidence;
 1060045        }
 46
 47        /// <summary> The text content of the word. </summary>
 1590848        public string Text { get; }
 49        /// <summary> Bounding box of an extracted word. </summary>
 1590850        public IReadOnlyList<float> BoundingBox { get; }
 51        /// <summary> Confidence value. </summary>
 2755252        public float? Confidence { get; }
 53    }
 54}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TextWord.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 TextWord
 15    {
 16        internal static TextWord DeserializeTextWord(JsonElement element)
 17        {
 1060018            string text = default;
 1060019            IReadOnlyList<float> boundingBox = default;
 1060020            Optional<float> confidence = default;
 8053621            foreach (var property in element.EnumerateObject())
 22            {
 2966823                if (property.NameEquals("text"))
 24                {
 1060025                    text = property.Value.GetString();
 1060026                    continue;
 27                }
 1906828                if (property.NameEquals("boundingBox"))
 29                {
 1060030                    List<float> array = new List<float>();
 19080031                    foreach (var item in property.Value.EnumerateArray())
 32                    {
 8480033                        array.Add(item.GetSingle());
 34                    }
 1060035                    boundingBox = array;
 1060036                    continue;
 37                }
 846838                if (property.NameEquals("confidence"))
 39                {
 846840                    confidence = property.Value.GetSingle();
 41                    continue;
 42                }
 43            }
 1060044            return new TextWord(text, boundingBox, Optional.ToNullable(confidence));
 45        }
 46    }
 47}