Skip to content

Commit bfa2006

Browse files
author
Jake Ginnivan
committed
Added FluentScanner overload to StepActionFactory
1 parent b96c37e commit bfa2006

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

TestStack.BDDfy/Scanners/StepScanners/Fluent/FluentScanner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void AddStep(Expression<Action<TScenario>> stepAction, string stepTextTe
127127

128128
stepTitle = stepTitle.Trim();
129129
var action = stepAction.Compile();
130-
_steps.Add(new ExecutionStep(o => action((TScenario)o), stepTitle, asserts, executionOrder, reports));
130+
_steps.Add(new ExecutionStep(StepActionFactory.GetStepAction(action), stepTitle, asserts, executionOrder, reports));
131131
}
132132

133133
public IGiven<TScenario> Given(Expression<Action<TScenario>> givenStep, string stepTextTemplate = null)

TestStack.BDDfy/Scanners/StepScanners/StepActionFactory.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@ public static Action<object> GetStepAction(MethodInfo method, object[] inputs)
99
{
1010
return o => method.Invoke(o, inputs);
1111
}
12+
13+
public static Action<object> GetStepAction<TScenario>(Action<TScenario> action)
14+
where TScenario : class
15+
{
16+
return o => action((TScenario) o);
17+
}
1218
}
1319
}

0 commit comments

Comments
 (0)