// TODO (adamralph): provide overload with out stepBeginsContinueOnFailure public StepCommand(MethodCall methodCall, int contextOrdinal, int stepOrdinal, Step step, bool stepBeginsContinueOnFailure) : base(methodCall, contextOrdinal, stepOrdinal) { Guard.AgainstNullArgument("methodCall", methodCall); Guard.AgainstNullArgument("step", step); if (step.Name == null) { throw new ArgumentException("The step name is null.", "step"); } this.step = step; this.stepBeginsContinueOnFailure = stepBeginsContinueOnFailure; var provider = CultureInfo.InvariantCulture; string stepName; try { stepName = string.Format(provider, step.Name, methodCall.Arguments.Select(argument => argument.Value ?? "null").ToArray()); } catch (FormatException) { stepName = step.Name; } this.Name = string.Format(provider, "{0} {1}", this.Name, stepName); this.DisplayName = string.Format(CultureInfo.InvariantCulture, "{0} {1}", this.DisplayName, stepName); }
public StepContext(string text, Func<IStepContext, Task> body, StepType stepType) { Guard.AgainstNullArgument("body", body); this.step = CurrentScenario.AddStep(text, () => body(this), stepType); }
public static Step AddStep(string name, Action body, object stepType) { var step = new Step(addingBackgroundSteps ? "(Background) " + name : name, body, stepType); Steps.Add(step); return step; }