Example #1
0
        public Table MapToTable(G.DataTable dataTable)
        {
            if (dataTable == null)
            {
                return(null);
            }

            var tableRows = dataTable.Rows;

            return(this.MapToTable(tableRows));
        }
        public void MapToTable_DataTableWithThreeRows_ReturnsTableWithHeaderRowAndTwoRows()
        {
            G.DataTable dataTable = this.factory.CreateGherkinDataTable(new[]
            {
                new[] { "Header row, first cell", "Header row, second cell" },
                new[] { "First row, first cell", "First row, second cell" },
                new[] { "Second row, first cell", "Second row, second cell" }
            });

            var mapper = new Mapper();

            var result = mapper.MapToTable(dataTable);

            Check.That(result.HeaderRow.Cells).ContainsExactly("Header row, first cell", "Header row, second cell");
            Check.That(result.DataRows).HasSize(2);
            Check.That(result.DataRows[0].Cells).ContainsExactly("First row, first cell", "First row, second cell");
            Check.That(result.DataRows[1].Cells).ContainsExactly("Second row, first cell", "Second row, second cell");
        }
Example #3
0
 public Table MapToTable(G.DataTable dataTable)
 {
     return(this.mapper.Map <Table>(dataTable));
 }
        private DataTable Clone(DataTable table, Func<TableCell, string> getCellValue = null)
        {
            if (table == null)
                return null;

            return new DataTable(table.Rows.Select(r => Clone(r, getCellValue)).ToArray());
        }
Example #5
0
 private void FormatDataTable(DataTable dataTable, StringBuilder result)
 {
     FormatHasRows(dataTable, result, STEPARG_INDENT);
 }