public async Task RunTestsForMutant(MutantsTestingOptions options, StoredMutantInfo storedMutantInfo) { _mutant.State = MutantResultState.Tested; var sw = new Stopwatch(); sw.Start(); _log.Info("Loading tests for mutant " + _mutant.Id); if (_choices.TestAssemblies.Count == 0) { throw new InvalidOperationException("_choices.TestAssemblies.Count == 0"); } _contexts = CreateTestContexts(storedMutantInfo.AssembliesPaths, _choices.TestAssemblies).ToList(); _log.Info("Running tests for mutant " + _mutant.Id); // _nUnitTesters = contexts.Select(_nunitService.SpawnTester).ToList(); // _nUnitTesterFactory.CreateWithParams(_nunitConsolePath, arg); IDisposable timoutDisposable = Observable.Timer(TimeSpan.FromMilliseconds(options.TestingTimeoutSeconds)) .Subscribe(e => CancelTestRun()); try { var results = await Task.WhenAll(_contexts.Select(t => t.RunTests())); _log.Debug("Finished waiting for tests. "); _mutant.TestRunContexts = _contexts; ResolveMutantState(results); _mutant.MutantTestSession.IsComplete = true; } catch (Exception e) { _log.Error(e.Message); SetError(e); } finally { timoutDisposable.Dispose(); sw.Stop(); _mutant.MutantTestSession.TestingTimeMiliseconds = sw.ElapsedMilliseconds; _mutant.MutantTestSession.TestingEnd = DateTime.Now; } }