Пример #1
0
 private void StopStep(ExecutionTimeWatch watch, bool stepStartNotified)
 {
     ScenarioExecutionContext.Current.Get <CurrentStepProperty>().RemoveCurrent(this);
     DisposeComposite();
     watch.Stop();
     _result.SetExecutionTime(watch.GetTime());
     _result.IncludeSubStepDetails();
     if (stepStartNotified)
     {
         _stepContext.ProgressNotifier.NotifyStepFinished(_result);
     }
 }
Пример #2
0
        private async Task TimeMeasuredInvokeAsync()
        {
            var watch = ExecutionTimeWatch.StartNew();

            try
            {
                await _decoratingExecutor.ExecuteStepAsync(this, InvokeStepAsync, _stepDecorators);
            }
            finally
            {
                _result.SetExecutionTime(watch.GetTime());
            }
        }
Пример #3
0
        private void MeasuredInvoke()
        {
            var watch = new Stopwatch();

            try
            {
                _result.SetExecutionStart(DateTimeOffset.UtcNow);
                watch.Start();
                _action();
            }
            finally
            {
                _result.SetExecutionTime(watch.Elapsed);
            }
        }
Пример #4
0
        private void MeasuredInvoke(object[] paramValues)
        {
            var watch = new Stopwatch();

            try
            {
                _result.SetExecutionStart(DateTimeOffset.UtcNow);
                watch.Start();
                _action(StepType.Default, _context, paramValues);
            }
            finally
            {
                _result.SetExecutionTime(watch.Elapsed);
            }
        }
Пример #5
0
        private async Task TimeMeasuredInvokeAsync()
        {
            var watch = ExecutionTimeWatch.StartNew();
            var ctx   = AsyncStepSynchronizationContext.InstallNew();

            try
            {
                try
                {
                    await _stepInvocation.Invoke(_scenarioContext, PrepareParameters());
                }
                finally
                {
                    ctx.RestoreOriginal();
                    await ctx.WaitForTasksAsync();
                }
            }
            finally
            {
                _result.SetExecutionTime(watch.GetTime());
            }
        }