< Summary

Class:Azure.AI.FormRecognizer.Models.DataTableCell
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\DataTableCell.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DataTableCell.cs
Covered lines:85
Uncovered lines:18
Coverable lines:103
Total lines:211
Line coverage:82.5% (85 of 103)
Covered branches:37
Total branches:46
Branch coverage:80.4% (37 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
DeserializeDataTableCell(...)-91.3%88.1%
.ctor(...)-70.59%71.43%
.ctor(...)-100%100%
get_RowIndex()-100%100%
get_ColumnIndex()-100%100%
get_RowSpan()-100%100%
get_ColumnSpan()-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Confidence()-100%100%
get_Elements()-100%100%
get_IsHeader()-100%100%
get_IsFooter()-100%100%
.ctor(...)-0%0%
.ctor(...)-100%100%
get_RowIndex()-100%100%
get_ColumnIndex()-100%100%
get_RowSpan()-100%100%
get_ColumnSpan()-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Confidence()-100%100%
get_Elements()-100%100%
get_IsHeader()-100%100%
get_IsFooter()-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using System.Text.Json;
 6using Azure.Core;
 7
 8// TODO: this file can be completely removed once we solve:
 9// https://github.com/Azure/azure-sdk-for-net/issues/11487
 10
 11namespace Azure.AI.FormRecognizer.Models
 12{
 13    [CodeGenModel("DataTableCell")]
 14    internal partial class DataTableCell
 15    {
 16        internal static DataTableCell DeserializeDataTableCell(JsonElement element)
 17        {
 244018            int rowIndex = default;
 244019            int columnIndex = default;
 244020            int? rowSpan = default;
 244021            int? columnSpan = default;
 244022            string text = default;
 244023            IReadOnlyList<float> boundingBox = default;
 244024            float confidence = Constants.DefaultConfidenceValue;
 244025            IReadOnlyList<string> elements = default;
 244026            bool? isHeader = default;
 244027            bool? isFooter = default;
 3463228            foreach (var property in element.EnumerateObject())
 029            {
 1487630                if (property.NameEquals("rowIndex"))
 031                {
 244032                    rowIndex = property.Value.GetInt32();
 244033                    continue;
 34                }
 1243635                if (property.NameEquals("columnIndex"))
 036                {
 244037                    columnIndex = property.Value.GetInt32();
 244038                    continue;
 039                }
 999640                if (property.NameEquals("rowSpan"))
 041                {
 58442                    if (property.Value.ValueKind == JsonValueKind.Null)
 43                    {
 44                        continue;
 45                    }
 58446                    rowSpan = property.Value.GetInt32();
 58447                    continue;
 48                }
 941249                if (property.NameEquals("columnSpan"))
 50                {
 59651                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 181655                    columnSpan = property.Value.GetInt32();
 59656                    continue;
 122057                }
 1003658                if (property.NameEquals("text"))
 122059                {
 366060                    text = property.Value.GetString();
 366061                    continue;
 122062                }
 759663                if (property.NameEquals("boundingBox"))
 122064                {
 366065                    List<float> array = new List<float>();
 4514066                    foreach (var item in property.Value.EnumerateArray())
 122067                    {
 1952068                        array.Add(item.GetSingle());
 69                    }
 366070                    boundingBox = array;
 244071                    continue;
 122072                }
 393673                if (property.NameEquals("confidence"))
 122074                {
 58475                    confidence = property.Value.GetSingle();
 180476                    continue;
 77                }
 457278                if (property.NameEquals("elements"))
 79                {
 340480                    if (property.Value.ValueKind == JsonValueKind.Null)
 81                    {
 122082                        continue;
 83                    }
 425684                    List<string> array = new List<string>();
 1071285                    foreach (var item in property.Value.EnumerateArray())
 122086                    {
 333287                        if (item.ValueKind == JsonValueKind.Null)
 122088                        {
 089                            array.Add(null);
 90                        }
 91                        else
 92                        {
 333293                            array.Add(item.GetString());
 94                        }
 95                    }
 202496                    elements = array;
 202497                    continue;
 98                }
 116899                if (property.NameEquals("isHeader"))
 100                {
 584101                    if (property.Value.ValueKind == JsonValueKind.Null)
 102                    {
 103                        continue;
 104                    }
 584105                    isHeader = property.Value.GetBoolean();
 584106                    continue;
 107                }
 584108                if (property.NameEquals("isFooter"))
 109                {
 584110                    if (property.Value.ValueKind == JsonValueKind.Null)
 111                    {
 112                        continue;
 113                    }
 584114                    isFooter = property.Value.GetBoolean();
 115                    continue;
 116                }
 117            }
 2440118            return new DataTableCell(rowIndex, columnIndex, rowSpan, columnSpan, text, boundingBox, confidence, elements
 119        }
 120    }
 121}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DataTableCell.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;
 11using Azure.Core;
 12
 13namespace Azure.AI.FormRecognizer.Models
 14{
 15    /// <summary> Information about the extracted cell in a table. </summary>
 16    internal partial class DataTableCell
 17    {
 18        /// <summary> Initializes a new instance of DataTableCell. </summary>
 19        /// <param name="rowIndex"> Row index of the cell. </param>
 20        /// <param name="columnIndex"> Column index of the cell. </param>
 21        /// <param name="text"> Text content of the cell. </param>
 22        /// <param name="boundingBox"> Bounding box of the cell. </param>
 23        /// <param name="confidence"> Confidence value. </param>
 24        /// <exception cref="ArgumentNullException"> <paramref name="text"/> or <paramref name="boundingBox"/> is null. 
 025        internal DataTableCell(int rowIndex, int columnIndex, string text, IEnumerable<float> boundingBox, float confide
 26        {
 027            if (text == null)
 28            {
 029                throw new ArgumentNullException(nameof(text));
 30            }
 031            if (boundingBox == null)
 32            {
 033                throw new ArgumentNullException(nameof(boundingBox));
 34            }
 35
 036            RowIndex = rowIndex;
 037            ColumnIndex = columnIndex;
 038            Text = text;
 039            BoundingBox = boundingBox.ToList();
 040            Confidence = confidence;
 041            Elements = new ChangeTrackingList<string>();
 042        }
 43
 44        /// <summary> Initializes a new instance of DataTableCell. </summary>
 45        /// <param name="rowIndex"> Row index of the cell. </param>
 46        /// <param name="columnIndex"> Column index of the cell. </param>
 47        /// <param name="rowSpan"> Number of rows spanned by this cell. </param>
 48        /// <param name="columnSpan"> Number of columns spanned by this cell. </param>
 49        /// <param name="text"> Text content of the cell. </param>
 50        /// <param name="boundingBox"> Bounding box of the cell. </param>
 51        /// <param name="confidence"> Confidence value. </param>
 52        /// <param name="elements"> When includeTextDetails is set to true, a list of references to the text elements co
 53        /// <param name="isHeader"> Is the current cell a header cell?. </param>
 54        /// <param name="isFooter"> Is the current cell a footer cell?. </param>
 122055        internal DataTableCell(int rowIndex, int columnIndex, int? rowSpan, int? columnSpan, string text, IReadOnlyList<
 56        {
 122057            RowIndex = rowIndex;
 122058            ColumnIndex = columnIndex;
 122059            RowSpan = rowSpan;
 122060            ColumnSpan = columnSpan;
 122061            Text = text;
 122062            BoundingBox = boundingBox;
 122063            Confidence = confidence;
 122064            Elements = elements;
 122065            IsHeader = isHeader;
 122066            IsFooter = isFooter;
 122067        }
 68
 69        /// <summary> Row index of the cell. </summary>
 122070        public int RowIndex { get; }
 71        /// <summary> Column index of the cell. </summary>
 122072        public int ColumnIndex { get; }
 73        /// <summary> Number of rows spanned by this cell. </summary>
 122074        public int? RowSpan { get; }
 75        /// <summary> Number of columns spanned by this cell. </summary>
 122076        public int? ColumnSpan { get; }
 77        /// <summary> Text content of the cell. </summary>
 122078        public string Text { get; }
 79        /// <summary> Bounding box of the cell. </summary>
 122080        public IReadOnlyList<float> BoundingBox { get; }
 81        /// <summary> Confidence value. </summary>
 122082        public float Confidence { get; }
 83        /// <summary> When includeTextDetails is set to true, a list of references to the text elements constituting thi
 223284        public IReadOnlyList<string> Elements { get; }
 85        /// <summary> Is the current cell a header cell?. </summary>
 122086        public bool? IsHeader { get; }
 87        /// <summary> Is the current cell a footer cell?. </summary>
 122088        public bool? IsFooter { get; }
 89    }
 90}