public void SetUp() { // Given _grammar = new GherkinGrammar(); _parser = new Parser(_grammar); _parseTree = _parser .Parse("# language: en\n" + "# some other remark\n" + "Feature: bla bla\n" + " as a ...\n" + " i want to ...\n" + " so that I ...\n" + " Scenario: first\n" + " Given a\n" + " When b\n" + " Then c\n" + " Scenario: second\n" + " Given x\n" + " When y\n" + " Then z\n"); }
public void SetParser(GherkinGrammar GherkinGrammar) { _parser = new Parser(GherkinGrammar) {Context = {Mode = ParseMode.VsLineScan}}; }
public LineScanner(GherkinGrammar GherkinGrammar) { //Debug.Print("LineScanner constructed using {0}", GherkinGrammar); _grammar = GherkinGrammar; SetParser(GherkinGrammar); }
public void Should_parse_dutch_feature_correctly() { // Given _grammar = new GherkinGrammar(NaturalLanguageFactory.GetLanguage("nl")); _parser = new Parser(_grammar); // When var tokens = _parser.Parse("Functionaliteit: bla\nScenario: bla\nStel x\nAls y\nDan z\n").Tokens; // Then AssertNoError(tokens); Assert.That(FeatureCount(tokens), Is.EqualTo(1), "Feature"); Assert.That(ScenarioCount(tokens), Is.EqualTo(1), "Scenario"); Assert.That(StepCount(tokens), Is.EqualTo(3), "Given/When/Then"); }
public void SetUp() { // Given _grammar = new GherkinGrammar(); _parser = new Parser(_grammar); }
private void InitParser(string sourceText) { if (GherkinGrammar != null && Equals(GherkinGrammar.GetLanguageFor(sourceText).Code, GherkinGrammar.Language.Code)) return; GherkinGrammar = GherkinGrammar.CreateFor(sourceText); parser = new Parser(GherkinGrammar); if (scanner != null) { scanner.SetParser(GherkinGrammar); scanner.StepProvider = _stepProvider; } else scanner = new LineScanner(GherkinGrammar) { StepProvider = _stepProvider}; }