PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Tests/TechTalk.SpecFlow.Specs/StepDefinitions/GherkinParserSteps.cs

http://github.com/techtalk/SpecFlow
C# | 49 lines | 42 code | 7 blank | 0 comment | 0 complexity | 9b2efc2d92d80499fe8047116bb88eda MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. using System.Collections.Generic;
  2. using TechTalk.SpecFlow.Assist;
  3. using System.Linq;
  4. using FluentAssertions;
  5. using TechTalk.SpecFlow.Specs.Drivers.Parser;
  6. namespace TechTalk.SpecFlow.Specs.StepDefinitions
  7. {
  8. [Binding]
  9. public class GherkinParserSteps
  10. {
  11. private readonly ParserDriver _parserDriver;
  12. public GherkinParserSteps(ParserDriver parserDriver)
  13. {
  14. _parserDriver = parserDriver;
  15. }
  16. [Given(@"there is a Gherkin file as")]
  17. public void GivenThereIsAGherkinFileAs(string text)
  18. {
  19. _parserDriver.FileContent = text;
  20. }
  21. [When(@"the file is parsed")]
  22. public void WhenTheFileIsParsed()
  23. {
  24. _parserDriver.ParseFile();
  25. }
  26. [Then(@"no parsing error is reported")]
  27. public void ThenNoParsingErrorIsReported()
  28. {
  29. _parserDriver.ParsingErrors.Should().BeEmpty("There are parsing errors");
  30. }
  31. [StepArgumentTransformation]
  32. public List<ExpectedError> ConvertExpectedErrors(Table table)
  33. {
  34. return table.CreateSet<ExpectedError>().ToList();
  35. }
  36. [Then(@"the following errors are provided")]
  37. public void ThenTheTheFollowingErrorsAreProvided(List<ExpectedError> expectedErrors)
  38. {
  39. _parserDriver.AssertErrors(expectedErrors);
  40. }
  41. }
  42. }