Ejemplo n.º 1
0
        public void CreateMutationProjects_WhenCreateMutationProjects_ShouldGetProjects()
        {
            var projects = _openProjectWorkspaceHandler.CreateMutationProjects(_fileConfig, _config.Solution);

            Assert.AreEqual(1, projects.Count);

            var project         = projects.First();
            var expectedProject = _config.MutationProjects.First();

            Assert.AreEqual(expectedProject.Project.Name, project.Project.Name);
            Assert.AreEqual(expectedProject.Project.OutputDirectoryPath, project.Project.OutputDirectoryPath);
            Assert.AreEqual(expectedProject.Project.OutputFileName, project.Project.OutputFileName);
        }
Ejemplo n.º 2
0
        public async Task <MutationConfig> Handle(OpenProjectCommand command, CancellationToken cancellationToken)
        {
            var                path = command.Path;
            MutationConfig     applicationConfig = null;
            MutationFileConfig fileConfig        = null;

            Log.Info($"Opening project at {command.Config?.SolutionPath ?? path}");

            try
            {
                (fileConfig, applicationConfig) = LoadConfigs(path, command.Config);

                // Solution and mutators
                applicationConfig.Solution = await _solutionHandler.OpenSolutionAsync(fileConfig.SolutionPath, fileConfig.BuildConfiguration, cancellationToken);

                applicationConfig.Mutators = _mutatorsHandler.InitializeMutators(fileConfig.Mutators, cancellationToken);

                // Filter
                applicationConfig.Filter.FilterItems.AddRange(_gitFilterHandler.CreateGitFilterItems(fileConfig.SolutionPath, fileConfig.Git, cancellationToken));

                // Projects
                applicationConfig.MutationProjects = _workspaceHandler.CreateMutationProjects(fileConfig, applicationConfig.Solution, cancellationToken);
                applicationConfig.TestProjects     = _workspaceHandler.CreateTestProjects(fileConfig, applicationConfig.Solution, cancellationToken);

                // Baseline
                applicationConfig.BaselineInfos = await _baselineHandler.RunBaselineAsync(applicationConfig, fileConfig.CreateBaseline, cancellationToken);

                Log.Info("Opening project finished.");
                return(applicationConfig);
            }
            catch (OperationCanceledException)
            {
                Log.Info("Open project was cancelled by request");
                return(applicationConfig);
            }
            catch (Exception ex)
            {
                Log.Error("Failed to open project");
                Log.Error(ex.Message);
                throw new OpenProjectException("Failed to open project", ex);
            }
        }