Ejemplo n.º 1
0
        public IRunResult Run(IRunIntent intent)
        {
            _listener.OnRunStarted(intent);

            IRunResult result;

            try
            {
                var suiteResults = intent.Intents
                                   .Select(x => Tuple.Create(x, Assembly.LoadFrom(x.Identity.Relative)))
                                   .GroupBy(x => GetTestType(x.Item2))
                                   .OrderByDescending(x => x.Key)
                                   .SelectMany(
                    group => group
#if PARALLEL
                    .AsParallel()
                    .WithCancellation(intent.CancellationTokenSource.Token)
                    .WithExecutionMode(ParallelExecutionMode.ForceParallelism)
#endif
                    .Select(x => RunAssemblySuites(x.Item2, intent.ShadowCopyPath, intent.CancellationTokenSource, x.Item1))).ToList();
                result = _resultFactory.CreateRunResult(intent, suiteResults);
            }
            catch (Exception exception)
            {
                _listener.OnError(ExceptionDescriptor.Create(exception));
                throw;
            }

            _listener.OnRunFinished(result);

            return(result);
        }