示例#1
0
 public InvocationResultTransformer(ScenarioRunner runner, Func <object, object[], Task <IStepResultDescriptor> > invocation, DecoratingExecutor decoratingExecutor, string groupPrefix)
 {
     _runner             = runner;
     _invocation         = invocation;
     _decoratingExecutor = decoratingExecutor;
     _groupPrefix        = groupPrefix;
 }
示例#2
0
        private RunnableStep[] ProvideSteps(DecoratingExecutor decoratingExecutor, object scenarioContext, IDependencyContainer container, StepDescriptor[] steps, string groupPrefix)
        {
            var    totalStepsCount      = steps.Length;
            string previousStepTypeName = null;
            var    result = new RunnableStep[totalStepsCount];

            for (var i = 0; i < totalStepsCount; ++i)
            {
                var step = ToRunnableStep(steps[i], i, totalStepsCount, previousStepTypeName, decoratingExecutor, scenarioContext, container, groupPrefix);
                result[i]            = step;
                previousStepTypeName = step.Result.Info.Name.StepTypeName?.OriginalName;
            }

            return(result);
        }
示例#3
0
        private RunnableStep ToRunnableStep(StepDescriptor descriptor, int stepIndex, int totalStepsCount,
                                            string previousStepTypeName, DecoratingExecutor decoratingExecutor, object scenarioContext,
                                            IDependencyContainer container, string groupPrefix)
        {
            var stepInfo        = new StepInfo(_metadataProvider.GetStepName(descriptor, previousStepTypeName), stepIndex + 1, totalStepsCount, groupPrefix);
            var arguments       = descriptor.Parameters.Select(p => new MethodArgument(p, _metadataProvider.GetValueFormattingServiceFor(p.ParameterInfo))).ToArray();
            var stepGroupPrefix = $"{stepInfo.GroupPrefix}{stepInfo.Number}.";

            return(new RunnableStep(
                       stepInfo,
                       new InvocationResultTransformer(this, container, descriptor.StepInvocation, decoratingExecutor, stepGroupPrefix).InvokeAsync,
                       arguments,
                       _exceptionProcessor,
                       _progressNotifier,
                       decoratingExecutor,
                       scenarioContext,
                       _metadataProvider.GetStepDecorators(descriptor),
                       container));
        }
示例#4
0
 private RunnableStep[] ProvideSteps(DecoratingExecutor decoratingExecutor, object scenarioContext, IDependencyContainer container)
 {
     return(ProvideSteps(decoratingExecutor, scenarioContext, container, _steps.ToArray(), string.Empty));
 }
示例#5
0
 private RunnableStep[] ProvideSteps(DecoratingExecutor decoratingExecutor, object scenarioContext)
 {
     return(ProvideSteps(decoratingExecutor, scenarioContext, _steps.ToArray(), string.Empty));
 }