Пример #1
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);
            }
        }
Пример #2
0
        public void InitializeMutators_WhenMutatorOperatorsIsNull_ShouldGetDefaultMutators()
        {
            var mutators = _openProjectMutatorsHandler.InitializeMutators(null);

            Assert.AreEqual(6, mutators.Count);
        }