コード例 #1
0
ファイル: TestExecutionEngine.cs プロジェクト: zplan/SpecFlow
        protected virtual TimeSpan ExecuteStepMatch(BindingMatch match, object[] arguments)
        {
            TimeSpan duration = TimeSpan.Zero;

            try
            {
                _bindingInvoker.InvokeBinding(match.StepBinding, _contextManager, arguments, _testTracer, out duration);
            }
            catch (Exception ex)
            {
                if (_stepErrorHandlers != null)
                {
                    StepFailureEventArgs stepFailureEventArgs = new StepFailureEventArgs(match.StepBinding, match.StepContext, ex);
                    foreach (var stepErrorHandler in _stepErrorHandlers)
                    {
                        stepErrorHandler.OnStepFailure(this, stepFailureEventArgs);
                    }

                    if (stepFailureEventArgs.IsHandled)
                    {
                        return(duration);
                    }
                }

                throw;
            }

            return(duration);
        }
コード例 #2
0
ファイル: TestExecutionEngine.cs プロジェクト: zplan/SpecFlow
        public virtual void InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
        {
            var currentContainer = GetHookContainer(hookType);
            var arguments        = ResolveArguments(hookBinding, currentContainer);

            invoker.InvokeBinding(hookBinding, _contextManager, arguments, _testTracer, out _);
        }
コード例 #3
0
        public void InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
        {
            var currentContainer = GetHookContainer(hookType);
            var arguments        = ResolveArguments(hookBinding, currentContainer);

            TimeSpan duration;

            invoker.InvokeBinding(hookBinding, contextManager, arguments, testTracer, out duration);
        }
コード例 #4
0
        private object DoTransform(IStepArgumentTransformationBinding stepTransformationBinding, object value, CultureInfo cultureInfo)
        {
            var parameters = stepTransformationBinding.Method.Parameters.ToArray();
            var arguments  = GetStepTransformationArguments(stepTransformationBinding, value, cultureInfo)
                             .Select((arg, i) => stepArgumentTypeConverter.Convert(arg, parameters[i].Type, cultureInfo)).ToArray();

            TimeSpan duration;

            return(bindingInvoker.InvokeBinding(stepTransformationBinding, contextManager, arguments, testTracer, out duration));
        }
コード例 #5
0
        protected virtual void ExecuteStepMatch(BindingMatch match, object[] arguments, out TimeSpan duration)
        {
            _testThreadExecutionEventPublisher.PublishEvent(new StepBindingStartedEvent(match.StepBinding));
            duration = default;

            try
            {
                _bindingInvoker.InvokeBinding(match.StepBinding, _contextManager, arguments, _testTracer, out duration);
            }
            finally
            {
                _testThreadExecutionEventPublisher.PublishEvent(new StepBindingFinishedEvent(match.StepBinding, duration));
            }
        }
コード例 #6
0
        private object DoTransform(IStepArgumentTransformationBinding stepTransformation, object value, CultureInfo cultureInfo)
        {
            object[] arguments;
            if (stepTransformation.Regex != null && value is string)
            {
                arguments = GetStepTransformationArgumentsFromRegex(stepTransformation, (string)value, cultureInfo);
            }
            else
            {
                arguments = new object[] { value }
            };

            TimeSpan duration;

            return(bindingInvoker.InvokeBinding(stepTransformation, contextManager, arguments, testTracer, out duration));
        }
コード例 #7
0
        public virtual void InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
        {
            var currentContainer = GetHookContainer(hookType);
            var arguments        = ResolveArguments(hookBinding, currentContainer);

            _testThreadExecutionEventPublisher.PublishEvent(new HookBindingStartedEvent(hookBinding));
            TimeSpan duration = default;

            try
            {
                invoker.InvokeBinding(hookBinding, _contextManager, arguments, _testTracer, out duration);
            }
            finally
            {
                _testThreadExecutionEventPublisher.PublishEvent(new HookBindingFinishedEvent(hookBinding, duration));
            }
        }
コード例 #8
0
 protected virtual void ExecuteStepMatch(BindingMatch match, object[] arguments, out TimeSpan duration)
 {
     _bindingInvoker.InvokeBinding(match.StepBinding, _contextManager, arguments, _testTracer, out duration);
 }
コード例 #9
0
        public static void InvokeHook(this IBindingInvoker invoker, IHookBinding hookBinding, IContextManager contextManager, ITestTracer testTracer)
        {
            TimeSpan duration;

            invoker.InvokeBinding(hookBinding, contextManager, null, testTracer, out duration);
        }