-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4dda02
commit fe5d740
Showing
5 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TechTalk.SpecFlow.Parser.SyntaxElements; | ||
|
||
namespace TechTalk.SpecFlow.Parser.GherkinBuilder | ||
{ | ||
internal class TableBuilder : ITableProcessor | ||
{ | ||
private readonly List<Row> tableRows = new List<Row>(); | ||
|
||
public Table GetResult() | ||
{ | ||
return tableRows.Count == 0 ? null : | ||
new Table(tableRows[0], tableRows.Skip(1).ToArray()); | ||
} | ||
|
||
public void ProcessTableRow(string[] cells, int lineNumber) | ||
{ | ||
var row = new Row(cells.Select(c => new Cell(c)).ToArray()); | ||
row.FilePosition = new FilePosition(lineNumber, 1); | ||
|
||
if (tableRows.Count > 0 && tableRows[0].Cells.Length != row.Cells.Length) | ||
{ | ||
throw new SpecFlowParserException( | ||
new ErrorDetail | ||
{ | ||
Line = row.FilePosition.Line, | ||
Column = row.FilePosition.Column, | ||
Message = "Number of cells in the row does not match the number of cells in the header!" | ||
}); | ||
} | ||
|
||
tableRows.Add(row); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters