public void DigestScenarioStepValues_Sets_DataTable_Value() { //arrange. var featureInstance = new FeatureWithDataTableScenarioStep(); var sut = StepMethodInfo.FromMethodInfo( featureInstance.GetType().GetMethod(nameof(FeatureWithDataTableScenarioStep.When_DataTable_Is_Expected)), featureInstance ); var step = CreateGherkinDocument("some scenario 1212", "When " + FeatureWithDataTableScenarioStep.Steptext + Environment.NewLine + @" | First argument | Second argument | Result | | 1 | 2 | 3| | a | b | c | " ).Feature.Children.First().Steps.First(); //act. sut.DigestScenarioStepValues(step); //assert. var digestedText = sut.GetDigestedStepText(); Assert.Equal(FeatureWithDataTableScenarioStep.Steptext, digestedText); }
public void FromMethodInfo_Creates_StepMethodInfo_With_DataTable() { //arrange. var featureInstance = new FeatureWithDataTableScenarioStep(); //act. var sut = StepMethodInfo.FromMethodInfo( featureInstance.GetType().GetMethod(nameof(FeatureWithDataTableScenarioStep.When_DataTable_Is_Expected)), featureInstance ); //assert. Assert.NotNull(sut); }
public void DigestScenarioStepValues_Sets_DataTable_Value() { //arrange. var featureInstance = new FeatureWithDataTableScenarioStep(); var sut = StepMethodInfo.FromMethodInfo( featureInstance.GetType().GetMethod(nameof(FeatureWithDataTableScenarioStep.When_DataTable_Is_Expected)), featureInstance ); var step = new Gherkin.Ast.Step( null, "When", FeatureWithDataTableScenarioStep.Steptext, new Gherkin.Ast.DataTable(new Gherkin.Ast.TableRow[] { new Gherkin.Ast.TableRow(null, new Gherkin.Ast.TableCell[] { new Gherkin.Ast.TableCell(null, "First argument"), new Gherkin.Ast.TableCell(null, "Second argument"), new Gherkin.Ast.TableCell(null, "Result"), }), new Gherkin.Ast.TableRow(null, new Gherkin.Ast.TableCell[] { new Gherkin.Ast.TableCell(null, "1"), new Gherkin.Ast.TableCell(null, "2"), new Gherkin.Ast.TableCell(null, "3"), }), new Gherkin.Ast.TableRow(null, new Gherkin.Ast.TableCell[] { new Gherkin.Ast.TableCell(null, "a"), new Gherkin.Ast.TableCell(null, "b"), new Gherkin.Ast.TableCell(null, "c"), }) })); //act. sut.DigestScenarioStepValues(step); //assert. var digestedText = sut.GetDigestedStepText(); Assert.Equal(FeatureWithDataTableScenarioStep.Steptext, digestedText); }