Skip to content

Commit d320941

Browse files
authored
Merge pull request #75 from quantori/remove-static-scenario-context
Removed static scenario contexts from files
2 parents 785f405 + ac22185 commit d320941

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ namespace Behavioral.Automation.Bindings
1010
public sealed class ControlScopeSelectionBinding
1111
{
1212
private readonly IScopeContextManager _contextManager;
13+
private readonly ScenarioContext _scenarioContext;
1314

14-
public ControlScopeSelectionBinding(IScopeContextManager contextManager)
15+
public ControlScopeSelectionBinding(IScopeContextManager contextManager, ScenarioContext scenarioContext)
1516
{
1617
_contextManager = contextManager;
18+
_scenarioContext = scenarioContext;
1719
}
1820

1921

@@ -23,7 +25,7 @@ public ControlScopeSelectionBinding(IScopeContextManager contextManager)
2325
public void ExecuteMultipleActionsInsideControlScope(ControlScopeSelector controlScopeSelector,
2426
[NotNull] Table actionsTable)
2527
{
26-
var stepDefinitionType = ScenarioStepContext.Current.StepInfo.StepDefinitionType;
28+
var stepDefinitionType = _scenarioContext.StepContext.StepInfo.StepDefinitionType;
2729
using (var controlScopeRuntime = _contextManager.UseControlScopeContextRuntime(controlScopeSelector))
2830
{
2931
foreach (var action in actionsTable.Rows)
@@ -40,7 +42,7 @@ public void ExecuteActionWithTableArgsInsideControlScope(ControlScopeSelector co
4042
string action,
4143
Table table)
4244
{
43-
var stepDefinitionType = ScenarioStepContext.Current.StepInfo.StepDefinitionType;
45+
var stepDefinitionType = _scenarioContext.StepContext.StepInfo.StepDefinitionType;
4446
using (var controlScopeRuntime = _contextManager.UseControlScopeContextRuntime(controlScopeSelector))
4547
{
4648
controlScopeRuntime.RunAction(action, stepDefinitionType, table);
@@ -52,8 +54,8 @@ public void ExecuteActionWithTableArgsInsideControlScope(ControlScopeSelector co
5254
[Then("inside (.+?): (.+?)")]
5355
public void ExecuteActionInsideControlScope(ControlScopeSelector controlScopeSelector, string action)
5456
{
55-
var stepDefinitionType = ScenarioStepContext.Current.StepInfo.StepDefinitionType;
56-
57+
var stepDefinitionType = _scenarioContext.StepContext.StepInfo.StepDefinitionType;
58+
5759
using (var controlScopeRuntime = _contextManager.UseControlScopeContextRuntime(controlScopeSelector))
5860
{
5961
controlScopeRuntime.RunAction(action, stepDefinitionType);

0 commit comments

Comments
 (0)