private void SetupScenario(ITestRunner testRunnerMock, Feature feature, Scenario scenario, Dictionary <string, string> paramSubst) { testRunnerMock.Expect(tr => tr.OnScenarioStart(null)).IgnoreArguments(); if (feature.Background != null) { foreach (var step in feature.Background.Steps) { SetupStepMock(testRunnerMock, step, paramSubst); } } foreach (var step in scenario.Steps) { SetupStepMock(testRunnerMock, step, paramSubst); } testRunnerMock.Expect(tr => tr.CollectScenarioErrors()).IgnoreArguments(); testRunnerMock.Expect(tr => tr.OnScenarioEnd()).IgnoreArguments(); }
private void SetupStepMock(ITestRunner testRunnerMock, ScenarioStep step, Dictionary <string, string> paramSubst) { if (IsOf <Given>(step)) { AddStepConstraints(testRunnerMock.Expect(tr => tr.Given(null, null, null)), step, paramSubst); } else if (IsOf <When>(step)) { AddStepConstraints(testRunnerMock.Expect(tr => tr.When(null, null, null)), step, paramSubst); } else if (IsOf <Then>(step)) { AddStepConstraints(testRunnerMock.Expect(tr => tr.Then(null, null, null)), step, paramSubst); } else if (IsOf <And>(step)) { AddStepConstraints(testRunnerMock.Expect(tr => tr.And(null, null, null)), step, paramSubst); } else if (IsOf <But>(step)) { AddStepConstraints(testRunnerMock.Expect(tr => tr.But(null, null, null)), step, paramSubst); } }