Ejemplo n.º 1
0
        public virtual Token Read()
        {
            var line     = reader.ReadLine();
            var location = new Ast.Location(++lineNumber);

            return(line == null ? new Token(null, location) : new Token(new GherkinLine(line, lineNumber), location));
        }
Ejemplo n.º 2
0
        protected ParserException(string message, Location location)
            : base(GetMessage(message, location))
        {
            if (location == null) throw new ArgumentNullException("location");

            Location = location;
        }
Ejemplo n.º 3
0
 public Step(Location location, string keyword, string text, StepArgument argument)
 {
     Location = location;
     Keyword = keyword;
     Text = text;
     Argument = argument;
 }
Ejemplo n.º 4
0
        private static string GetMessage(string message, Location location)
        {
            if (location == null)
                return message;

            return string.Format("({0}:{1}): {2}", location.Line, location.Column, message);
        }
Ejemplo n.º 5
0
 public Background(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
Ejemplo n.º 6
0
 public virtual GherkinDialect GetDialect(string language, Ast.Location location)
 {
     if (!TryGetDialect(language, location, out var dialect))
     {
         throw new NoSuchLanguageException(language, location);
     }
     return(dialect);
 }
Ejemplo n.º 7
0
 public NoSuchLanguageException(string language, Ast.Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null)
     {
         throw new ArgumentNullException("language");
     }
 }
Ejemplo n.º 8
0
        protected virtual GherkinDialect GetDialect(string language, Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
        {
            GherkinLanguageSetting languageSettings;
            if (!gherkinLanguageSettings.TryGetValue(language, out languageSettings))
                throw new NoSuchLanguageException(language, location);

            return CreateGherkinDialect(language, languageSettings);
        }
Ejemplo n.º 9
0
 protected ScenarioDefinition(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
Ejemplo n.º 10
0
 public ReportStep(Location location, string keyword, string text, StepArgument argument, Parser.StepKeyword stepKeyword, Parser.ScenarioBlock scenarioBlock)
 {
     //Location = location;
     Keyword = keyword;
     Text = text;
     Argument = argument;
     ScenarioBlock = scenarioBlock;
     StepKeyword = stepKeyword;
 }
Ejemplo n.º 11
0
        private static string GetMessage(string message, Ast.Location location)
        {
            if (location == null)
            {
                return(message);
            }

            return(string.Format("({0}:{1}): {2}", location.Line, location.Column, message));
        }
Ejemplo n.º 12
0
 public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children)
 {
     Tags = tags;
     Location = location;
     Language = language;
     Keyword = keyword;
     Name = name;
     Description = description;
     Children = children;
 }
Ejemplo n.º 13
0
 public Examples(Tag[] tags, Location location, string keyword, string name, string description, TableRow header, TableRow[] body)
 {
     Tags = tags;
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     TableHeader = header;
     TableBody = body;
 }
        public void MapToLocation_RegularLocation_ReturnsLocation()
        {
            var mapper = this.factory.CreateMapper();

            G.Location location = this.factory.CreateLocation(1, 2);
            Location   result   = mapper.MapToLocation(location);

            Check.That(result).IsNotNull();
            Check.That(result.Line).IsEqualTo(1);
            Check.That(result.Column).IsEqualTo(2);
        }
Ejemplo n.º 15
0
 public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments)
 {
     Tags = tags;
     Location = location;
     Language = language;
     Keyword = keyword;
     Name = name;
     Description = description;
     Background = background;
     ScenarioDefinitions = scenarioDefinitions;
     Comments = comments;
 }
Ejemplo n.º 16
0
        public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children)
            : base(tags, location, language, keyword, name, description, children)
        {
            if (Children != null)
            {
                ScenarioDefinitions = Children.Where(child => !(child is Background)).ToList();

                var background = Children.SingleOrDefault(child => child is Background);

                if (background != null)
                {
                    Background = (Background)background;
                }
            }
        }
Ejemplo n.º 17
0
 public InvalidTagException(string message, Ast.Location location = null) :
     base(message, location)
 {
 }
Ejemplo n.º 18
0
 protected virtual TableCell CreateTableCell(Ast.Location location, string value)
 {
     return(new TableCell(location, value));
 }
Ejemplo n.º 19
0
 public ScenarioOutline(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
     Examples = examples;
 }
Ejemplo n.º 20
0
 protected virtual Feature CreateFeature(Tag[] tags, Ast.Location location, string language, string keyword, string name, string description, IHasLocation[] children, AstNode node)
 {
     return(new Feature(tags, location, language, keyword, name, description, children));
 }
Ejemplo n.º 21
0
 protected virtual Tag CreateTag(Ast.Location location, string name, AstNode node)
 {
     return(new Tag(location, name));
 }
 public override GherkinDialect GetDialect(string language, Location location)
 {
     string languageOnly = StripCulture(language);
     return base.GetDialect(languageOnly, location);
 }
Ejemplo n.º 23
0
 protected virtual DocString CreateDocString(Ast.Location location, string contentType, string content, AstNode node)
 {
     return(new DocString(location, contentType, content));
 }
Ejemplo n.º 24
0
 public SemanticParserException(string message, Location location) : base(message, location)
 {
 }
Ejemplo n.º 25
0
 public ScenarioOutline(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
     : base(location, keyword, name, description, steps)
 {
     Tags     = tags;
     Examples = examples;
 }
Ejemplo n.º 26
0
 public Tag(Location location, string name)
 {
     Name = name;
     Location = location;
 }
Ejemplo n.º 27
0
 public SpecFlowStep(Location location, string keyword, string text, StepArgument argument, StepKeyword stepKeyword, ScenarioBlock scenarioBlock) : base(location, keyword, text, argument)
 {
     StepKeyword = stepKeyword;
     ScenarioBlock = scenarioBlock;
 }
Ejemplo n.º 28
0
 public Token(IGherkinLine line, Location location)
 {
     Line = line;
     Location = location;
 }
Ejemplo n.º 29
0
 public NoSuchLanguageException(string language, Location location)
     : base("Language not supported: " + language, location)
 {
 }
Ejemplo n.º 30
0
 public AstBuilderException(string message, Location location)
     : base(message, location)
 {
     if (message == null) throw new ArgumentNullException("message");
     if (location == null) throw new ArgumentNullException("location");
 }
Ejemplo n.º 31
0
        private static string GetMessage(string message, Location location)
        {
            if (location == null) throw new ArgumentNullException("location");

            return string.Format("({0}:{1}): {2}", location.Line, location.Column, message);
        }
Ejemplo n.º 32
0
 public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments, string sourceFilePath) : base(tags, location, language, keyword, name, description, background, scenarioDefinitions, comments)
 {
     this.SourceFilePath = sourceFilePath;
 }
Ejemplo n.º 33
0
        internal G.GherkinDocument CreateGherkinDocument(string name, string description, string[] tags = null, G.Background background = null, G.ScenarioDefinition[] scenarioDefinitions = null, G.Comment[] comments = null, G.Location location = null, string language = null)
        {
            var nonNullScenarioDefinitions = scenarioDefinitions ?? new G.ScenarioDefinition[0];

            return(new G.GherkinDocument(
                       new G.Feature(
                           (tags ?? new string[0]).Select(this.CreateTag).ToArray(),
                           location,
                           language,
                           "Feature",
                           name,
                           description,
                           background != null ? new G.ScenarioDefinition[] { background }.Concat(nonNullScenarioDefinitions).ToArray() : nonNullScenarioDefinitions),
                       comments));
        }
Ejemplo n.º 34
0
        protected virtual bool TryGetDialect(string language, Ast.Location location, out GherkinDialect dialect)
        {
            var gherkinLanguageSettings = LoadLanguageSettings();

            return(TryGetDialect(language, gherkinLanguageSettings, location, out dialect));
        }
Ejemplo n.º 35
0
 public virtual Token Read()
 {
     var line = reader.ReadLine();
     var location = new Location(++lineNumber);
     return line == null ? new Token(null, location) : new Token(new GherkinLine(line, lineNumber), location);
 }
Ejemplo n.º 36
0
 public NoSuchLanguageException(string language, Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null) throw new ArgumentNullException("language");
 }
Ejemplo n.º 37
0
 protected virtual Scenario CreateScenario(Tag[] tags, Ast.Location location, string keyword, string name, string description, Step[] steps, Examples[] examples, AstNode node)
 {
     return(new Scenario(tags, location, keyword, name, description, steps, examples));
 }
Ejemplo n.º 38
0
        protected virtual bool TryGetDialect(string language, Dictionary <string, GherkinLanguageSetting> gherkinLanguageSettings, Ast.Location location, out GherkinDialect dialect)
        {
            if (!gherkinLanguageSettings.TryGetValue(language, out var languageSettings))
            {
                dialect = null;
                return(false);
            }

            dialect = CreateGherkinDialect(language, languageSettings);
            return(true);
        }
Ejemplo n.º 39
0
 protected virtual Step CreateStep(Ast.Location location, string keyword, string text, StepArgument argument, AstNode node)
 {
     return(new Step(location, keyword, text, argument));
 }
Ejemplo n.º 40
0
 public Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
 }
Ejemplo n.º 41
0
 protected virtual Rule CreateRule(Ast.Location location, string keyword, string name, string description, IHasLocation[] children, AstNode node)
 {
     return(new Rule(location, keyword, name, description, children));
 }
Ejemplo n.º 42
0
 protected ParserException(string message, Ast.Location location = null) : base(GetMessage(message, location))
 {
     Location = location;
 }
Ejemplo n.º 43
0
 protected virtual TableRow CreateTableRow(Ast.Location location, TableCell[] cells, AstNode node)
 {
     return(new TableRow(location, cells));
 }
Ejemplo n.º 44
0
 public AstBuilderException(string message, Ast.Location location) : base(message, location)
 {
 }
Ejemplo n.º 45
0
 protected virtual void HandleAstError(string message, Ast.Location location)
 {
     throw new AstBuilderException(message, location);
 }
Ejemplo n.º 46
0
 public AstBuilderException(string message, Location location) : base(message, location)
 {
 }
Ejemplo n.º 47
0
 public DocString(Location location, string contentType, string content)
 {
     Location = location;
     ContentType = contentType;
     Content = content;
 }
Ejemplo n.º 48
0
 public Token(IGherkinLine line, Ast.Location location)
 {
     Line     = line;
     Location = location;
 }
Ejemplo n.º 49
0
 public TableRow(Location location, TableCell[] cells)
 {
     Location = location;
     Cells = cells;
 }
Ejemplo n.º 50
0
 protected ParserException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     Location = (Location)info.GetValue("Location", typeof(Location));
 }
Ejemplo n.º 51
0
 internal G.Scenario CreateScenario(string[] tags, string name, string description, G.Step[] steps, G.Location location = null)
 {
     G.Scenario scenario = new G.Scenario(
         tags.Select(this.CreateTag).ToArray(),
         location ?? AnyLocation,
         "Scenario",
         name,
         description,
         steps);
     return(scenario);
 }
Ejemplo n.º 52
0
 protected virtual Background CreateBackground(Ast.Location location, string keyword, string name, string description, Step[] steps, AstNode node)
 {
     return(new Background(location, keyword, name, description, steps));
 }
Ejemplo n.º 53
0
 public virtual GherkinDialect GetDialect(string language, Location location)
 {
     var gherkinLanguageSettings = LoadLanguageSettings();
     return GetDialect(language, gherkinLanguageSettings, location);
 }
Ejemplo n.º 54
0
 protected virtual Comment CreateComment(Ast.Location location, string text)
 {
     return(new Comment(location, text));
 }
Ejemplo n.º 55
0
 public Location MapToLocation(G.Location location)
 {
     return(this.mapper.Map <Location>(location));
 }
Ejemplo n.º 56
0
 protected virtual Examples CreateExamples(Tag[] tags, Ast.Location location, string keyword, string name, string description, TableRow header, TableRow[] body, AstNode node)
 {
     return(new Examples(tags, location, keyword, name, description, header, body));
 }
Ejemplo n.º 57
0
 public Location MapToLocation(G.Location location)
 {
     return(location != null ? new Location {
         Column = location.Column, Line = location.Line
     } : null);
 }
 protected override GherkinDialect GetDialect(string language, Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
 {
     string languageOnly = StripCulture(language);
     return base.GetDialect(languageOnly, gherkinLanguageSettings, location);
 }