public async Task FSharpProjectDiff_should_be_tracked() { var sample = ProjectSampleGenerator.GetFSharpSolutionSample("FSharpSolution.sln"); var solutionFullPath = sample.SolutionFile.GetFullPath(Repository.BasePath); var fsharpProjectFullPath = sample.FSharpProjectFile.GetFullPath(Repository.BasePath); var csharpProjectFullPath = sample.CSharpProjectFile.GetFullPath(Repository.BasePath); Repository .WriteFile(sample.SolutionFile) .WriteFile(sample.CSharpProjectFile) .WriteFile(sample.FSharpProjectFile) .Commit("Created new solution with fsharp and csharp projects") .CreateBranch("foo") .CheckoutBranch("foo") .WriteFile(sample.CSharpProjectFile.Name, sample.CSharpProjectFile.Content + " ") .WriteFile(sample.FSharpProjectFile.Name, sample.FSharpProjectFile.Content + " ") .Commit("Updated both project files"); var logger = new TestOutputLogger(_outputHelper); var settings = new BuildSettings("master", solutionFullPath, Repository.BasePath); var workspace = SetupMsBuildWorkspace(); var emitTask = new EmitDependencyGraphTask(settings, workspace, logger); var affectedFiles = (await emitTask.Run()).ToList(); affectedFiles.Select(f => f.Key).Should().HaveCount(2).And.Subject.Should().BeEquivalentTo(fsharpProjectFullPath, csharpProjectFullPath); }
public void ImportedFilePathIsFound() { var sample = ProjectSampleGenerator.GetProjectWithImportSample("SampleProject.csproj"); var projectFilePath = sample.ProjectFile.GetFullPath(Repository.BasePath); var importedPropsFilePath = Path.Combine(Repository.BasePath, sample.ImportedPropsFile.Name); Repository .WriteFile(sample.ProjectFile) .WriteFile(sample.ImportedPropsFile); var projectFile = new SlnFileWithPath(projectFilePath, new SlnFile(FileType.Project, ProjectId.CreateNewId())); var imports = ProjectImportsFinder.FindProjectImports(new[] { projectFile }); imports.Values.Should().BeEquivalentTo(new ImportedFile(importedPropsFilePath, new[] { projectFile }.ToImmutableList())); }
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); }