private async Task <RunSummary> RunTestCaseWithMethodFixturesAsync(IXunitTestCase testCase, TaskObserver taskObserver, ITestMainThread testMainThread) { var runSummary = new RunSummary(); var methodFixtures = CreateMethodFixtures(testCase, runSummary); if (Aggregator.HasExceptions) { return(runSummary); } var testCaseConstructorArguments = await InitializeMethodFixturesAsync(testCase, runSummary, methodFixtures); if (!Aggregator.HasExceptions) { var testCaseRunSummary = await GetTestRunSummary(RunTestCaseAsync(testCase, testCaseConstructorArguments), taskObserver.Task); runSummary.Aggregate(testCaseRunSummary); } await DisposeMethodFixturesAsync(testCase, runSummary, methodFixtures); await WaitForObservedTasksAsync(testCase, runSummary, taskObserver, testMainThread); return(runSummary); }
private Task WaitForObservedTasksAsync(IXunitTestCase testCase, RunSummary runSummary, TaskObserver taskObserver, ITestMainThread testMainThread) { testMainThread.CancelPendingTasks(); taskObserver.TestCompleted(); return(RunActionAsync(testCase, () => taskObserver.Task, runSummary, "Tasks that have been started during test run are still not completed")); }