Ejemplo n.º 1
0
        private RunnableStep[] ProvideSteps(IMetadataInfo parent, IEnumerable <StepDescriptor> stepDescriptors, object context, IDependencyContainer container, string groupPrefix, Func <Exception, bool> shouldAbortSubStepExecutionFn)
        {
            var descriptors = stepDescriptors.ToArray();

            if (!descriptors.Any())
            {
                throw new InvalidOperationException("At least one step has to be provided");
            }

            var metadataProvider = _context.IntegrationContext.MetadataProvider;

            var    totalSteps           = descriptors.Length;
            var    steps                = new RunnableStep[totalSteps];
            string previousStepTypeName = null;

            var extensions  = _context.IntegrationContext.ExecutionExtensions;
            var stepContext = new RunnableStepContext(_context.ExceptionProcessor, _context.ProgressNotifier, container, context, ProvideSteps, shouldAbortSubStepExecutionFn);

            for (var stepIndex = 0; stepIndex < totalSteps; ++stepIndex)
            {
                var descriptor = descriptors[stepIndex];
                var stepInfo   = new StepInfo(parent, metadataProvider.GetStepName(descriptor, previousStepTypeName), stepIndex + 1, totalSteps, groupPrefix);
                var arguments  = descriptor.Parameters.Select(p => new MethodArgument(p, metadataProvider.GetValueFormattingServiceFor(p.ParameterInfo))).ToArray();

                steps[stepIndex]     = new RunnableStep(stepContext, stepInfo, descriptor, arguments, extensions.StepDecorators.Concat(metadataProvider.GetStepDecorators(descriptor)));
                previousStepTypeName = stepInfo.Name.StepTypeName?.OriginalName;
            }

            return(steps);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        private RunnableStep[] ProvideSteps(ExtendableExecutor extendableExecutor, object scenarioContext)
        {
            var    descriptors          = _steps.ToArray();
            var    totalStepsCount      = descriptors.Length;
            string previousStepTypeName = null;
            var    result = new RunnableStep[totalStepsCount];

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

            return(result);
        }