public async Task <IEnumerable <TestRunResult> > RunMutationTestAsync(TimeSpan timeout, MutationSessionProgressTracker sessionProgressTracker, ITestHostRunFactory testHostRunnerFactory, TestProjectDuplication testProject, ILogger logger) { ExecuteMutations(testProject); var runningTests = _mutationVariants.Where(y => !y.CausesTimeOut) .SelectMany(x => x.MutationIdentifier.TestCoverage); var testRunner = testHostRunnerFactory.CreateTestRunner(testProject.TestProjectFile.FullFilePath(), timeout, logger); var testResults = await testRunner.RunTests(timeout, sessionProgressTracker, runningTests); ResetMutations(testProject); return(new List <TestRunResult> { new() { TestResults = testResults, Mutations = _mutationVariants } });
/// <summary> /// Returns information about the test project. /// </summary> /// <returns></returns> private TestProjectInfo GetTestProjectInfo(TestProjectDuplication duplication, IProjectInfo testProjectInfo) { var testFramework = GetTestFramework(testProjectInfo); // Read the test project into memory. var projectInfo = new TestProjectInfo { TestFramework = testFramework, TestModule = ModuleDefinition.ReadModule(duplication.TestProjectFile.FullFilePath()) }; // Foreach project reference load it in memory as an 'assembly mutator'. foreach (var projectReferencePath in duplication.TestProjectReferences) { var loadProjectReferenceModel = new AssemblyMutator(projectReferencePath.FullFilePath()); if (loadProjectReferenceModel.Types.Count > 0) { projectInfo.DependencyAssemblies.Add(loadProjectReferenceModel); } } return(projectInfo); }