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

MapToTable() public method

public MapToTable ( IEnumerable tableRows ) : PicklesDoc.Pickles.ObjectModel.Table
tableRows IEnumerable
return PicklesDoc.Pickles.ObjectModel.Table
        public Table MapToTable(IEnumerable<G.TableRow> tableRows)
        {
            return new Table
            {
                HeaderRow = this.MapToTableRow(tableRows.First()),
                DataRows = tableRows.Skip(1).Select(this.MapToTableRow).ToList()
            };
        }

Same methods

Mapper::MapToTable ( Gherkin.Ast dataTable ) : 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