Example #1
0
        private StringStep AddStepToScenario(ScenarioFragment currentStage, string step)
        {
            var stringStep = CreateStringStep(currentStage, step);

            Scenario.AddStep(stringStep);
            return(stringStep);
        }
Example #2
0
        private void AddStepAndExecute(ScenarioFragment currentStage, string step, Action inlineImplementation)
        {
            if (inlineImplementation != null)
            {
                StepRunner.RegisterImplementation(currentStage, step, inlineImplementation);
            }

            if (!Scenario.Steps.Any())
            {
                RunHooks <BeforeScenarioAttribute>();
                CountStepsToRunBeforeCallingAfterScenario();
            }
            stepsCalled++;
            var stringStep = AddStepToScenario(currentStage, step);

            RunStep(currentStage, step, stringStep);

            RunAfterScenario();

            previousStage = currentStage;
            var failure = stringStep.StepResult.Result as Failed;

            if (failure != null)
            {
                throw new ApplicationException("Failed on step " + step, failure.Exception);
            }
        }
Example #3
0
        private void RunStep(ScenarioFragment currentStage, string step, StringStep stringStep)
        {
            var stepToRun = new StringStep(string.Format("{0} {1}", currentStage, step), Scenario.Source);

            StepRunner.Run(stepToRun);
            stringStep.StepResult = new StepResult(stringStep, stepToRun.StepResult.Result);
        }
Example #4
0
 public void RegisterImplementation(ScenarioFragment currentScenarioStage, string step, Action implementation)
 {
     if (implementation != null)
     {
         var stepKey = currentScenarioStage + " " + step;
         RegisterImpl(stepKey, implementation);
         RegisterImpl("And " + step, implementation);
     }
 }
 public void RegisterImplementation(ScenarioFragment currentScenarioStage, string step, Action implementation)
 {
     if (implementation != null)
     {
         var stepKey = currentScenarioStage + " " + step;
         RegisterImpl(stepKey, implementation);
         RegisterImpl("And " + step, implementation);
     }
 }
 public void RegisterImplementation(ScenarioFragment currentScenarioStage, string step, Action implementation)
 {
     if (implementation != null)
     {
         var stepKey = currentScenarioStage + " " + step;
         if (_inlineImplementations.ContainsKey(stepKey))
             _inlineImplementations.Remove(stepKey);
         _inlineImplementations.Add(stepKey, implementation);
     }
 }
Example #7
0
        private StringStep CreateStringStep(ScenarioFragment currentStage, string step)
        {
            string stepType = currentStage.ToString();

            if (Scenario.Steps.Any() && previousStage == currentStage)
            {
                stepType = "And";
            }
            var stringStep = new StringStep(stepType, step, Scenario.Source);

            return(stringStep);
        }
Example #8
0
        private void RunStep(ScenarioFragment currentStage, string step, StringStep stringStep)
        {
            var stepToRun = new StringStep(currentStage.ToString(), step, Scenario.Source);

            try
            {
                RunHooks <BeforeStepAttribute>();
            }
            catch (Exception e)
            {
                stringStep.StepResult = new StepResult(stringStep, new Failed(e));
            }
            try
            {
                StepRunner.Run(stepToRun);
                stringStep.StepResult = new StepResult(stringStep, stepToRun.StepResult.Result);
            }
            finally
            {
                RunHooks <AfterStepAttribute>();
            }
        }
 public void RegisterImplementation(ScenarioFragment scenarioStage, string step, Action implementation)
 {
     _inlineImplementations.RegisterImplementation(scenarioStage, step, implementation);
 }
Example #10
0
 public void RegisterImplementation(ScenarioFragment scenarioStage, string step, Action implementation)
 {
     _inlineImplementations.RegisterImplementation(scenarioStage, step, implementation);
 }