@@ -20,21 +20,22 @@ static ProjectCollection GetProjects(ConvertableFilePath slnPath, string configu
2020 var solution = ParseSolution ( slnPath ) ;
2121 var projects = solution . Projects . Where ( p => p . Type != "{2150E333-8FDC-42A3-9474-1A3956D46DE8}" ) ;
2222 var testAssemblies = projects . Where ( p => p . Name . Contains ( ".Tests" ) ) . Select ( p => p . Path . GetDirectory ( ) + "/bin/" + configuration + "/" + p . Name + ".dll" ) ;
23- return new ProjectCollection {
24- SolutionPath = slnPath ,
25- SourceProjects = projects . Where ( p => ! p . Name . Contains ( ".Tests" ) ) ,
26- TestProjects = projects . Where ( p => p . Name . Contains ( ".Tests" ) )
27- } ;
23+ return new ProjectCollection (
24+ SolutionPath : slnPath ,
25+ SourceProjects : projects . Where ( p => ! p . Name . Contains ( ".Tests" ) ) ,
26+ TestProjects : projects . Where ( p => p . Name . Contains ( ".Tests" ) )
27+ ) ;
2828
2929 }
3030}
3131
32- public class ProjectCollection {
33- public ConvertableFilePath SolutionPath { get ; set ; }
34- public IEnumerable < SolutionProject > SourceProjects { get ; set ; }
35- public IEnumerable < DirectoryPath > SourceProjectPaths { get { return SourceProjects . Select ( p => p . Path . GetDirectory ( ) ) ; } }
36- public IEnumerable < SolutionProject > TestProjects { get ; set ; }
37- public IEnumerable < DirectoryPath > TestProjectPaths { get { return TestProjects . Select ( p => p . Path . GetDirectory ( ) ) ; } }
38- public IEnumerable < SolutionProject > AllProjects { get { return SourceProjects . Concat ( TestProjects ) ; } }
39- public IEnumerable < DirectoryPath > AllProjectPaths { get { return AllProjects . Select ( p => p . Path . GetDirectory ( ) ) ; } }
32+ public record ProjectCollection (
33+ ConvertableFilePath SolutionPath ,
34+ IEnumerable < SolutionProject > SourceProjects ,
35+ IEnumerable < SolutionProject > TestProjects )
36+ {
37+ public ICollection < DirectoryPath > SourceProjectPaths => field ??= [ .. SourceProjects . Select ( p => p . Path . GetDirectory ( ) ) ] ;
38+ public ICollection < DirectoryPath > TestProjectPaths => field ??= [ .. TestProjects . Select ( p => p . Path . GetDirectory ( ) ) ] ;
39+ public ICollection < SolutionProject > AllProjects => field ??= [ .. SourceProjects . Concat ( TestProjects ) ] ;
40+ public ICollection < DirectoryPath > AllProjectPaths => field ??= [ .. AllProjects . Select ( p => p . Path . GetDirectory ( ) ) ] ;
4041}
0 commit comments