@@ -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