Example #1
1
        public Feature Parse(TextReader featureFileReader)
        {
            var language = this.DetermineLanguage();
            var gherkinParser = new Gherkin.Parser();

            Gherkin.Ast.Feature feature = gherkinParser.Parse(
                new Gherkin.TokenScanner(featureFileReader),
                new Gherkin.TokenMatcher(language));

            Feature result = new Mapper(feature.Language).MapToFeature(feature);

            return result;
        }
Example #2
0
        public Feature Parse(TextReader featureFileReader)
        {
            var gherkinParser = new Gherkin.Parser();
            Gherkin.Ast.Feature feature = gherkinParser.Parse(featureFileReader);
            Feature result = new Mapper(feature.Language).MapToFeature(feature);

            return result;
        }
        public void MapToTable_NullDataTable_ReturnsNullTable()
        {
            var mapper = new Mapper();

            Table result = mapper.MapToTable(null);

            Check.That(result).IsNull();
        }
        public void MapToTableRow_NullTableRow_ReturnsNull()
        {
            var mapper = new Mapper();

            TableRow result = mapper.MapToTableRow(null);

            Check.That(result).IsNull();
        }
        public void MapToStringTableCell_NullTableCell_ReturnsNull()
        {
            var mapper = new Mapper();

            string result = mapper.MapToString((G.TableCell)null);

            Check.That(result).IsNull();
        }
Example #6
0
        public Feature Parse(TextReader featureFileReader)
        {
            var language = this.DetermineLanguage();
            var gherkinParser = new Gherkin.Parser();

            Gherkin.Ast.GherkinDocument gherkinDocument = gherkinParser.Parse(
                new Gherkin.TokenScanner(featureFileReader),
                new Gherkin.TokenMatcher(language));

            Feature result = new Mapper(this.configuration, gherkinDocument.Feature.Language).MapToFeature(gherkinDocument);

            return result;
        }
        public void MapToTableRow_RowWithCellValues_ReturnsRowContainingThoseValues()
        {
            G.TableRow row = this.factory.CreateGherkinTableRow(
                new[]
                {
                    "first cell",
                    "second cell"
                });

            var mapper = new Mapper();

            var result = mapper.MapToTableRow(row);

            Check.That(result.Cells).ContainsExactly("first cell", "second cell");
        }
Example #8
0
 internal Mapper CreateMapper(IConfiguration configuration, string defaultLanguage = "en")
 {
     var mapper = new Mapper(configuration, defaultLanguage);
     return mapper;
 }
Example #9
0
 internal Mapper CreateMapper(string defaultLanguage = "en")
 {
     var mapper = new Mapper(defaultLanguage);
     return mapper;
 }
        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");
        }