Ejemplo n.º 1
0
        /// <summary>Execute cell comparisons for a data row</summary>
        /// <param name="row">the index of the row to be compared</param>
        /// <returns>the list of cell comparisons that didn't pass (empty list if all passed)</returns>
        private List <CellComparison> RowErrors(int row)
        {
            var currentRow = row < ExpectedTable.RowCount
                ? ExpectedTable.DataCell(row, 0)
                : ActualTable.DataCell(row, 0);
            var result     = new List <CellComparison>();
            var maxColumns = Math.Max(ExpectedTable.Row(row).Length, ActualTable.Row(row).Length);

            for (var column = 0; column < maxColumns; column++)
            {
                var currentColumn = ExpectedTable.Header(column);
                var expectedValue = ExpectedTable.DataCell(row, column);
                var actualValue   = ActualTable.DataCell(row, column);
                // reset tolerance range to force recalculating per comparison
                _tolerance.DataRange = null;
                var comparison = new CellComparison(
                    row, currentRow, column, currentColumn, expectedValue, actualValue, _tolerance
                    );
                if (!comparison.Cell.IsOk())
                {
                    result.Add(comparison);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>Execute cell comparison for the header row</summary>
        /// <returns>the list of cell comparisons that didn't pass (empty list if all passed)</returns>
        private List <CellComparison> HeaderErrors()
        {
            const int headerRowNo = -1;
            var       maxColumns  = Math.Max(ExpectedTable.ColumnCount, ActualTable.ColumnCount);
            var       result      = new List <CellComparison>();
            var       rowName     = ExpectedTable.Header(0);

            for (var column = 0; column < maxColumns; column++)
            {
                var columnName = ExpectedTable.Header(column);
                var comparison = new CellComparison(
                    headerRowNo, rowName, column, columnName, columnName, ActualTable.Header(column), _tolerance
                    );
                if (!comparison.Cell.IsOk())
                {
                    result.Add(comparison);
                }
            }
            return(result);
        }