PicklesDoc.Pickles.ObjectModel.Mapper.MapToTable C# (CSharp) Method

MapToTable() public method

public MapToTable ( Gherkin.Ast dataTable ) : PicklesDoc.Pickles.ObjectModel.Table
dataTable Gherkin.Ast
return PicklesDoc.Pickles.ObjectModel.Table
        public Table MapToTable(G.DataTable dataTable)
        {
            if (dataTable == null)
            {
                return null;
            }

            var tableRows = dataTable.Rows;
            return this.MapToTable(tableRows);
        }

Same methods

Mapper::MapToTable ( IEnumerable tableRows ) : PicklesDoc.Pickles.ObjectModel.Table

Usage Example

        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");
        }
All Usage Examples Of PicklesDoc.Pickles.ObjectModel.Mapper::MapToTable