Skip to content

Commit 34248c3

Browse files
mwhelanJakeGinnivan
authored andcommitted
Fixed Issue #212
Changed ReflectiveWithExamples test to have an AndGiven step which produced the additional redundant AndThen step. Modified MethodNameStepScanner to return the first match it finds. Not sure why it would return multiple steps for one method (unless it is to do with RunStepWithArgs)? No tests failed so I'm hoping that's not the case.
1 parent d9c3b2d commit 34248c3

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/TestStack.BDDfy.Tests/Scanner/Examples/ReflectiveWithExamples.Run.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Scenario: Reflective with examples
33
Given step with <first example> passed as parameter
4-
Given step with <second example> accessed via property
4+
And step with <second example> accessed via property
55

66
Examples:
77
| First Example | Second Example |

src/TestStack.BDDfy.Tests/Scanner/Examples/ReflectiveWithExamples.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void GivenStepWith__FirstExample__PassedAsParameter(int firstExample)
1414
firstExample.ShouldBeOneOf(1, 2);
1515
}
1616

17-
public void GivenStepWith__SecondExample__AccessedViaProperty()
17+
public void AndGivenStepWith__SecondExample__AccessedViaProperty()
1818
{
1919
SecondExample.ShouldBeOneOf("foo", "bar");
2020
}

src/TestStack.BDDfy/Scanners/StepScanners/MethodName/MethodNameStepScanner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo method, Examp
8989
continue;
9090

9191
var returnsItsText = method.ReturnType == typeof(IEnumerable<string>);
92-
yield return GetStep(testContext.TestObject, matcher, method, returnsItsText, example);
92+
return new[] { GetStep(testContext.TestObject, matcher, method, returnsItsText, example)};
9393
}
94+
return Enumerable.Empty<Step>();
9495
}
9596

9697
private Step GetStep(object testObject, MethodNameMatcher matcher, MethodInfo method, bool returnsItsText, Example example)

0 commit comments

Comments
 (0)