public void RunStep(StepMatch stepMatch) { var action = stepMatch.StepDefinition.Action; var matches = stepMatch.MatchedArguments.Select(a => a.Value); var tables = stepMatch.TableArguments.Cast<object>(); var arguments = matches.Concat(tables).ToArray(); action.DynamicInvoke(arguments); }
public void Step_Closure_Should_Be_Able_To_Mutate_WorldView() { var stepDefinition = exampleStepSet.StepDefinitions.ToArray()[1]; var stepMatch = new StepMatch { StepDefinition = stepDefinition, MatchedArguments = new[] { new MatchedArgument { Text = "42", Value="42", Position = 19 } } }; stepRunner.RunStep(stepMatch); (exampleStepSet.Counter).Should().Be.EqualTo(42); }
private void OnBeforeStep(StepMatch stepMatch) { if (BeforeStep != null) BeforeStep(this, new StepEventArgs { StepMatch = stepMatch }); }
private void OnAfterStep(StepMatch stepMatch) { if (AfterStep != null) AfterStep(this, new StepEventArgs { StepMatch = stepMatch }); }
public void SetUp() { stepDefinition = new StepDefinition { Regex = new Regex("^everybody does the (.*)$"), Action = new Action<string>(s => { }) }; this.step1 = "everybody does the Bartman"; this.matchesRequest1 = new StepMatchesRequest { NameToMatch = this.step1 }; this.step2 = "everybody does the Dew"; this.matchesRequest2 = new StepMatchesRequest { NameToMatch = this.step2 }; this.stepMatch1 = new StepMatch { StepDefinition = this.stepDefinition }; this.stepMatch2 = new StepMatch { StepDefinition = this.stepDefinition }; stepMatcher = new Mock<IMatchSteps>(); stepRunner = new Mock<IRunSteps>(); processor = new Processor(stepMatcher.Object, stepRunner.Object); }