Skip to content

Commit f3c811e

Browse files
committed
Modified ExecutableAttributeStepScanner to find ExecutableAttributes on method ancestors.
1 parent 3989402 commit f3c811e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

TestStack.BDDfy/Scanners/StepScanners/ExecutableAttribute/ExecutableAttributeStepScanner.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ExecutableAttributeStepScanner : IStepScanner
2828
{
2929
public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo candidateMethod)
3030
{
31-
var executableAttribute = (ExecutableAttribute)candidateMethod.GetCustomAttributes(typeof(ExecutableAttribute), false).FirstOrDefault();
31+
var executableAttribute = (ExecutableAttribute)candidateMethod.GetCustomAttributes(typeof(ExecutableAttribute), true).FirstOrDefault();
3232
if(executableAttribute == null)
3333
yield break;
3434

@@ -38,7 +38,7 @@ public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo candidateMeth
3838

3939
var stepAsserts = IsAssertingByAttribute(candidateMethod);
4040

41-
var runStepWithArgsAttributes = (RunStepWithArgsAttribute[])candidateMethod.GetCustomAttributes(typeof(RunStepWithArgsAttribute), false);
41+
var runStepWithArgsAttributes = (RunStepWithArgsAttribute[])candidateMethod.GetCustomAttributes(typeof(RunStepWithArgsAttribute), true);
4242
if (runStepWithArgsAttributes.Length == 0)
4343
{
4444
var stepAction = StepActionFactory.GetStepAction(candidateMethod, new object[0]);
@@ -71,7 +71,7 @@ public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo candidateMeth
7171

7272
public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo method, Example example)
7373
{
74-
var executableAttribute = (ExecutableAttribute)method.GetCustomAttributes(typeof(ExecutableAttribute), false).FirstOrDefault();
74+
var executableAttribute = (ExecutableAttribute)method.GetCustomAttributes(typeof(ExecutableAttribute), true).FirstOrDefault();
7575
if (executableAttribute == null)
7676
yield break;
7777

@@ -112,7 +112,7 @@ private static bool IsAssertingByAttribute(MethodInfo method)
112112

113113
private static ExecutableAttribute GetExecutableAttribute(MethodInfo method)
114114
{
115-
return (ExecutableAttribute)method.GetCustomAttributes(typeof(ExecutableAttribute), false).First();
115+
return (ExecutableAttribute)method.GetCustomAttributes(typeof(ExecutableAttribute), true).First();
116116
}
117117
}
118118
}

0 commit comments

Comments
 (0)