Beispiel #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);
        }
Beispiel #2
0
        public IRunResult CreateRunResult(IRunIntent intent, IEnumerable <ISuiteResult> suiteResults)
        {
            var suiteResultsList = suiteResults.ToList();
            var state            = GetOverallState(Convert(suiteResultsList));

            return(new RunResult(intent.Identity, "You're so great!", state, suiteResultsList));
        }
Beispiel #3
0
 public static void AddTypes(this IRunIntent runIntent, IEnumerable <Type> types)
 {
     foreach (var assemblyWithTypes in types.GroupBy(x => x.Assembly))
     {
         var intent = Intent.Create(GetIdentity(assemblyWithTypes.Key));
         runIntent.AddIntent(intent);
         assemblyWithTypes.ForEach(x => intent.AddIntent(Intent.Create(GetIdentity(x))));
     }
 }
Beispiel #4
0
        public static IRunResult Run(IRunIntent runIntent, params IRunListener[] listeners)
        {
            var listener = CrossAppDomainRunListener.Create(listeners);

              var builder = new ContainerBuilder();
              var evaluationModule = new EvaluationModule(listener, runIntent.CreateSeparateAppDomains);
              builder.RegisterModule(evaluationModule);
              var container = builder.Build();

              var rootRunner = container.Resolve<IRootRunner>();
              return rootRunner.Run(runIntent);
        }
Beispiel #5
0
        public static IRunResult Run(IRunIntent runIntent, params IRunListener[] listeners)
        {
            var listener = new CompositeRunListener(listeners);

            var builder          = new ContainerBuilder();
            var evaluationModule = new EvaluationModule(listener, runIntent.CreateSeparateAppDomains);

            builder.RegisterModule(evaluationModule);
            var container = builder.Build();

            var rootRunner = container.Resolve <IRootRunner>();

            return(rootRunner.Run(runIntent));
        }
 public override void OnRunStarted(IRunIntent intent)
 {
     _listeners.ForEach(x => x.OnRunStarted(intent));
 }
Beispiel #7
0
 public virtual void OnRunStarted(IRunIntent intent)
 {
 }
Beispiel #8
0
 public static void AddAssemblies(this IRunIntent runIntent, IEnumerable <Assembly> assemblies)
 {
     assemblies.Select(GetIdentity).Select(Intent.Create).ForEach(runIntent.AddIntent);
 }
Beispiel #9
0
 public static void AddType(this IRunIntent runIntent, Type type)
 {
     runIntent.AddTypes(new[] { type });
 }
Beispiel #10
0
 public virtual void OnRunStarted(IRunIntent intent)
 {
 }
Beispiel #11
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)))
            //.OrderBy(x => GetTestType(x.Item2))
            //.Select(x => RunAssemblySuites(x.Item2, intent.ShadowCopyPath, intent.CancellationTokenSource, x.Item1)).ToList();
            .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;
        }
Beispiel #12
0
 public void OnRunStarted(IRunIntent intent)
 {
     _listeners.ForEach(x => x.OnRunStarted(intent));
 }
 public void OnRunStarted(IRunIntent intent)
 {
     _listener.OnRunStarted(intent);
 }
Beispiel #14
0
 public void OnRunStarted(IRunIntent intent)
 {
     _listener.OnRunStarted(intent);
 }