private void ValidateProjectInSolution(Action <SlnProject, ProjectInSolution> customValidator, SlnProject[] projects, bool folders) { string solutionFilePath = GetTempFileName(); SlnFile slnFile = new SlnFile(); slnFile.AddProjects(projects); slnFile.Save(solutionFilePath, folders); MSBuildSolutionFile solutionFile = MSBuildSolutionFile.Parse(solutionFilePath); foreach (SlnProject slnProject in projects) { solutionFile.ProjectsByGuid.ContainsKey(slnProject.ProjectGuid.ToSolutionString()).ShouldBeTrue(); ProjectInSolution projectInSolution = solutionFile.ProjectsByGuid[slnProject.ProjectGuid.ToSolutionString()]; projectInSolution.AbsolutePath.ShouldBe(slnProject.FullPath); projectInSolution.ProjectGuid.ShouldBe(slnProject.ProjectGuid.ToSolutionString()); projectInSolution.ProjectName.ShouldBe(slnProject.Name); IEnumerable <string> configurationPlatforms = from configuration in slnProject.Configurations from platform in slnProject.Platforms select $"{configuration}|{platform}"; configurationPlatforms.ShouldBe(projectInSolution.ProjectConfigurations.Keys, ignoreOrder: true); customValidator?.Invoke(slnProject, projectInSolution); } }
private void ValidateProjectInSolution(Action <SlnProject, ProjectInSolution> customValidator, SlnProject[] projects) { string solutionFilePath = GetTempFileName(); SlnFile slnFile = new SlnFile(projects); slnFile.Save(solutionFilePath); MSBuildSolutionFile solutionFile = MSBuildSolutionFile.Parse(solutionFilePath); foreach (SlnProject slnProject in projects) { solutionFile.ProjectsByGuid.ContainsKey(slnProject.ProjectGuid).ShouldBeTrue(); ProjectInSolution projectInSolution = solutionFile.ProjectsByGuid[slnProject.ProjectGuid]; projectInSolution.AbsolutePath.ShouldBe(slnProject.FullPath); projectInSolution.ProjectGuid.ShouldBe(slnProject.ProjectGuid); projectInSolution.ProjectName.ShouldBe(slnProject.Name); customValidator?.Invoke(slnProject, projectInSolution); } }