public void MapToStep_StepWithTableArgument_ReturnStepWithTable() { var mapper = this.factory.CreateMapper(); G.Step step = this.factory.CreateStep( "When", "I use this table", new[] { new[] { "Header 1", "Header 2" }, new[] { "Value 1", "Value 2" }, }); var result = mapper.MapToStep(step); Check.That(result.Keyword).IsEqualTo(Keyword.When); Check.That(result.NativeKeyword).IsEqualTo("When"); Check.That(result.Name).IsEqualTo("I use this table"); Check.That(result.TableArgument.HeaderRow.Cells).ContainsExactly("Header 1", "Header 2"); Check.That(result.TableArgument.DataRows).HasSize(1); Check.That(result.TableArgument.DataRows[0].Cells).ContainsExactly("Value 1", "Value 2"); Check.That(result.DocStringArgument).IsNull(); Check.That(result.Location).IsNull(); Check.That(result.Comments).IsEmpty(); }
protected ScenarioDefinition(Location location, string keyword, string name, string description, Step[] steps) { Location = location; Keyword = keyword; Name = name; Description = description; Steps = steps; }
public Background(Location location, string keyword, string name, string description, Step[] steps) { Location = location; Keyword = keyword; Name = name; Description = description; Steps = steps; }
private void FormatStep(Step step, StringBuilder result) { result.Append(INDENT); FormatHasLocation(step, result); result.Append(step.Keyword); result.Append(step.Text); result.AppendLine(); if (step.Argument is DocString) FormatDocString((DocString)step.Argument, result); else if (step.Argument is DataTable) FormatDataTable((DataTable)step.Argument, result); }
public void MapToStep_StepWithWhen_ReturnStep() { var mapper = this.factory.CreateMapper(); G.Step step = this.factory.CreateStep("When", "I press 'enter'"); var result = mapper.MapToStep(step); Check.That(result.Keyword).IsEqualTo(Keyword.When); Check.That(result.NativeKeyword).IsEqualTo("When"); Check.That(result.Name).IsEqualTo("I press 'enter'"); Check.That(result.DocStringArgument).IsNull(); Check.That(result.TableArgument).IsNull(); }
public void MapToStep_StepWithDocStringArgument_ReturnStepWithDocString() { var mapper = this.factory.CreateMapper(); G.Step step = this.factory.CreateStep("Then", "I see this value on the screen", "120"); var result = mapper.MapToStep(step); Check.That(result.Keyword).IsEqualTo(Keyword.Then); Check.That(result.NativeKeyword).IsEqualTo("Then"); Check.That(result.Name).IsEqualTo("I see this value on the screen"); Check.That(result.DocStringArgument).IsEqualTo("120"); Check.That(result.TableArgument).IsNull(); }
public void MapToStep_StepWithoutArgument_ReturnStep() { var mapper = this.factory.CreateMapper(); G.Step step = this.factory.CreateStep("Given", "I enter '50' in the calculator"); var result = mapper.MapToStep(step); Check.That(result.Keyword).IsEqualTo(Keyword.Given); Check.That(result.NativeKeyword).IsEqualTo("Given"); Check.That(result.Name).IsEqualTo("I enter '50' in the calculator"); Check.That(result.DocStringArgument).IsNull(); Check.That(result.TableArgument).IsNull(); }
public MethodInfo GetStepMethod (Step step, IEnumerable<MethodInfo> availableMethods) { MethodInfo result = null; foreach (var method in availableMethods) { var attrs = method.GetCustomAttributes <BaseStepAttribute> (); foreach (var a in attrs) { if (String.Compare(a.StepText, step.Text, true) == 0) { result = method; } } } return result; }
public Step MapToStep(G.Step step) { if (step == null) { return(null); } return(new Step { Location = this.MapToLocation(step.Location), DocStringArgument = step.Argument is G.DocString ? this.MapToString((G.DocString)step.Argument) : null, Keyword = this.MapToKeyword(step.Keyword), NativeKeyword = step.Keyword, Name = step.Text, TableArgument = step.Argument is G.DataTable ? this.MapToTable((G.DataTable)step.Argument) : null, }); }
public void MapToStep_StepWithLocation_ReturnStepWithLocation() { var mapper = this.factory.CreateMapper(); G.Step step = this.factory.CreateStep( "Given", "I am on a step", 3, 4 ); var result = mapper.MapToStep(step); Check.That(result.Keyword).IsEqualTo(Keyword.Given); Check.That(result.NativeKeyword).IsEqualTo("Given"); Check.That(result.Name).IsEqualTo("I am on a step"); Check.That(result.DocStringArgument).IsNull(); Check.That(result.TableArgument).IsNull(); Check.That(result.Location).IsNotNull(); Check.That(result.Location.Line).IsEqualTo(3); Check.That(result.Location.Column).IsEqualTo(4); Check.That(result.Comments).IsEmpty(); }
public Step MapToStep(G.Step step) { if (step == null) { return(null); } var stepResult = new Step { Location = this.MapToLocation(step.Location), DocStringArgument = step.Argument is G.DocString ? this.MapToString((G.DocString)step.Argument) : null, Keyword = this.MapToKeyword(step.Keyword), NativeKeyword = step.Keyword, Name = step.Text, TableArgument = step.Argument is G.DataTable ? this.MapToTable((G.DataTable)step.Argument) : null }; var comments = this.resourceFileMapper.MapFiles(step.Text, stepResult.Location); stepResult.Comments.AddRange(comments); return(stepResult); }
public Background(Location location, string keyword, string name, string description, Step[] steps) : base(location, keyword, name, description, steps) { }
public Step MapToStep(G.Step step) { return(this.mapper.Map <Step>(step)); }
internal G.Step CreateStep(string keyword, string text, int locationLine, int locationColumn) { var step = new G.Step(this.CreateLocation(locationLine, locationColumn), keyword, text, null); return(step); }
internal G.Step CreateStep(string keyword, string text, int locationLine, int locationColumn) { var step = new G.Step(this.CreateLocation(locationLine, locationColumn), keyword, text, null); return step; }
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; }
public Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps) : base(location, keyword, name, description, steps) { Tags = tags; }
public void Log (Step step) { Console.WriteLine (" {0}{1}", step.Keyword, step.Text); }
Step CreateStep (string keyword, string text) { var location = new Location (0, 0); var arg = new StepArgumentMock (); var step = new Step (location, keyword, text, arg); return step; }