public async Task <Dictionary <string, ICollection <string> > > Run() { // start the cancellation timer. _cts.CancelAfter(Settings.TimeoutDuration); var loadSln = new LoadSolutionCmd(Logger, _workspace, _cts.Token); var slnFile = await loadSln.Process(Task.FromResult(Settings.SolutionFile)); var getFilesCmd = new GatherAllFilesInSolutionCmd(Logger, _cts.Token, Settings.WorkingDirectory); var filterFilesCmd = new FilterAffectedProjectFilesCmd(Logger, _cts.Token, Settings.WorkingDirectory, Settings.TargetBranch); var createDependencyGraph = new ComputeDependencyGraphCmd(Logger, _cts.Token, slnFile); var affectedFiles = await createDependencyGraph.Process( filterFilesCmd.Process(getFilesCmd.Process(Task.FromResult(slnFile)))); return(affectedFiles); }
public async Task Should_mark_project_as_changed_when_only_imported_file_changed() { var sample = ProjectSampleGenerator.GetProjectWithImportSample("SampleProject.csproj"); var projectFilePath = sample.ProjectFile.GetFullPath(Repository.BasePath); Repository .WriteFile(sample.ProjectFile) .WriteFile(sample.ImportedPropsFile) .Commit("Created sample project") .CreateBranch("foo") .CheckoutBranch("foo") .WriteFile(sample.ImportedPropsFile.Name, sample.ImportedPropsFile.Content + " ") .Commit("Updated imported file with a space"); var cmd = new FilterAffectedProjectFilesCmd(new TestOutputLogger(_outputHelper), new CancellationToken(), Repository.BasePath, "master"); var solutionFiles = new Dictionary <string, SlnFile>() { [projectFilePath] = new SlnFile(FileType.Project, ProjectId.CreateNewId()) }; var filteredAffectedFiles = await cmd.Process(Task.FromResult(solutionFiles)); filteredAffectedFiles.Should().HaveCount(1).And.Subject.Keys.Should().BeEquivalentTo(projectFilePath); }