Пример #1
0
        private static GivenStep ParseBackgroundStep(LineReader reader)
        {
            if (!reader.IsGivenLine && !reader.IsAndLine && !reader.IsButLine)
            {
                throw new NotSupportedException(
                          $"Unrecognised step type on line '{reader.CurrentLineTrimmed}'. Only Given, And or But steps can be used in a Background.");
            }

            var stepTitle = reader.CurrentLineTrimmed;

            reader.ReadNextLine();

            var multiLineString = MultiLineStringParser.ParseMultiLineStringIfPresent(reader);

            var dataTable = DataTable.Empty;

            if (reader.IsTableLine)
            {
                dataTable = DataTableParser.ParseDataTable(reader);
            }

            return(new GivenStep(
                       stepTitle,
                       dataTable,
                       multiLineString));
        }
Пример #2
0
        private static IStep ParseStep(LineReader reader, Func <DataTable, string, IStep> stepFactory)
        {
            reader.ReadNextLine();

            var multiLineString = MultiLineStringParser.ParseMultiLineStringIfPresent(reader);

            var dataTable = DataTable.Empty;

            if (reader.IsTableLine)
            {
                dataTable = DataTableParser.ParseDataTable(reader);
            }

            return(stepFactory(dataTable, multiLineString));
        }
Пример #3
0
 private static DataTable ParseExamples(LineReader reader)
 {
     reader.ReadNextLine();
     return(DataTableParser.ParseDataTable(reader));
 }