< Summary

Class:Azure.AI.FormRecognizer.Models.FormTable
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\FormTable.cs
Covered lines:15
Uncovered lines:2
Coverable lines:17
Total lines:79
Line coverage:88.2% (15 of 17)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_PageNumber()-100%100%
get_Cells()-100%100%
get_ColumnCount()-100%100%
get_RowCount()-100%100%
get_Item(...)-0%100%
set_Item(...)-0%100%
ConvertCells(...)-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6
 7namespace Azure.AI.FormRecognizer.Models
 8{
 9    /// <summary>
 10    /// Represents a table recognized from the input document.
 11    /// </summary>
 12    public class FormTable
 13    {
 12814        internal FormTable(DataTable table, IReadOnlyList<ReadResult> readResults, int pageIndex)
 15        {
 12816            ReadResult readResult = readResults[pageIndex];
 17
 12818            PageNumber = readResult.Page;
 12819            ColumnCount = table.Columns;
 12820            RowCount = table.Rows;
 12821            Cells = ConvertCells(table.Cells, readResults, readResult.Page);
 12822        }
 23
 24        /// <summary>
 25        /// The 1-based number of the page in which this table is present.
 26        /// </summary>
 10027        public int PageNumber { get; }
 28
 29        /// <summary>
 30        /// A list of cells contained in this table.
 31        /// </summary>
 21632        public IReadOnlyList<FormTableCell> Cells { get; }
 33
 34        /// <summary>
 35        /// The number of columns in this table.
 36        /// </summary>
 38837        public int ColumnCount { get; }
 38
 39        /// <summary>
 40        /// The number of rows in this table.
 41        /// </summary>
 38842        public int RowCount { get; }
 43
 44        // TODO: implement table indexer
 45        // TODO: Handling column-span?
 46        // https://github.com/Azure/azure-sdk-for-net/issues/9975
 47
 48        /// <summary>
 49        /// </summary>
 50#pragma warning disable CA1822 // Mark as static
 51        internal FormTableCell this[int row, int column]
 52#pragma warning restore CA1822 // Mark as static
 53        {
 54            get
 55            {
 56#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations
 057                throw new NotImplementedException();
 58#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations
 59            }
 60
 61            set
 62            {
 063                throw new NotImplementedException();
 64            }
 65        }
 66
 67        private static IReadOnlyList<FormTableCell> ConvertCells(IReadOnlyList<DataTableCell> cellsResult, IReadOnlyList
 68        {
 12869            List<FormTableCell> cells = new List<FormTableCell>();
 70
 513671            foreach (var cellResult in cellsResult)
 72            {
 244073                cells.Add(new FormTableCell(cellResult, readResults, pageNumber));
 74            }
 75
 12876            return cells;
 77        }
 78    }
 79}