private void CreateTestDirectoryAndCopyDependenciesAndVerify(int expectedNumberOfFiles, string systemUnderTestPath)
        {
            var testRunnerDependencyFilesHandler = new TestRunnerDependencyFilesHandler(_mockFileSystem);

            var dllPath = testRunnerDependencyFilesHandler.CreateTestDirectoryAndCopyDependencies(_baseDirectory, _config.TestProjects.First(), systemUnderTestPath);

            Assert.IsFalse(string.IsNullOrEmpty(dllPath));

            var directory = Path.GetDirectoryName(dllPath);

            var files = _mockFileSystem.Directory.GetFiles(directory);

            Assert.AreEqual(expectedNumberOfFiles, files.Length);
            Assert.IsTrue(files.Any(f => f.Contains("MutationProject.dll")));
            Assert.IsTrue(files.Any(f => f.Contains("TestDependency.dll")));
            Assert.IsTrue(files.Any(f => f.Contains("TestDependency2.dll")));

            var directories = _mockFileSystem.Directory.GetDirectories(directory);

            Assert.AreEqual(1, directories.Count());

            var subTestDirectories = _mockFileSystem.Directory.GetFiles(directories.First());

            Assert.AreEqual(1, subTestDirectories.Count());
            Assert.IsTrue(subTestDirectories.First().Contains("TestDependency3.dll"));
        }
Exemplo n.º 2
0
        private async Task <TestSuiteResult> RunTestAsync(
            TestProject testProject,
            string dotNetPath,
            int maxTestTimeMin,
            string baselineDirectoryPath,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Log.Info($"Starting to run tests in {testProject.Project.OutputFileName} ({testProject.Project.Name})");

            var testDllPath = _testRunnerDependencyFilesHandler.CreateTestDirectoryAndCopyDependencies(baselineDirectoryPath, testProject, baselineDirectoryPath);

            return(await _testRunnerClient.RunTestsAsync(testProject.TestRunner, testDllPath, dotNetPath, TimeSpan.FromMinutes(maxTestTimeMin), cancellationToken));
        }