private ISuiteResult RunWithResourcesAcquired( IIntent intent, ISuiteProvider provider, IEnumerable <Tuple <IIntent, ISuiteProvider> > suitePairs, IEnumerable <Tuple <IIntent, ITestProvider> > testPairs) { _listener.OnSuiteStarted(intent, provider.Text); IOutputRecording outputRecording; IContextScope contextScope; ICollection <ISuiteResult> suiteResults = new ISuiteResult[0]; ICollection <ITestResult> testResults = new ITestResult[0]; using (outputRecording = _resultFactory.CreateOutputRecording()) { using (contextScope = _contextRunner.Run(provider.ContextProviders)) { if (contextScope.SetupResults.All(x => x.State == State.Passed)) { suiteResults = suitePairs.AsParallel() .WithDegreeOfParallelism(degreeOfParallelism: 1) .WithCancellation(_cancellationTokenSource.Token) .Select(x => Run(x.Item1, x.Item2)).ToList(); testResults = testPairs.AsParallel() .WithDegreeOfParallelism(degreeOfParallelism: 1) .WithCancellation(_cancellationTokenSource.Token) .Select(x => _testRunner.Run(x.Item1, x.Item2)).ToList(); } } } var result = _resultFactory.CreateSuiteResult( provider, outputRecording, contextScope.SetupResults, contextScope.CleanupResults, suiteResults, testResults); _listener.OnSuiteFinished(result); return(result); }