C24.ReVersion.SolutionParser.GetProjectPaths C# (CSharp) Method

GetProjectPaths() public method

public GetProjectPaths ( string solutionFileName ) : IEnumerable
solutionFileName string
return IEnumerable
        public IEnumerable<string> GetProjectPaths(string solutionFileName)
        {
            string slnText = this.fileSystem.ReadAllText(solutionFileName);
            return projectPathsRegex
                .Matches(slnText)
                .Cast<Match>()
                .SelectMany(x => x.Groups["ProjectPath"].Captures.Cast<Capture>())
                .Select(x => x.Value)
                .Where(x => x.ToLowerInvariant().EndsWith(".csproj"))
                .ToList();
        }
    }

Usage Example

 public void GetProjectPaths_Should_Throw_If_File_Does_Not_Exist()
 {
     var repo = new MockRepository(MockBehavior.Strict);
     Mock<IFileSystem> fileSystem = repo.Create<IFileSystem>();
     fileSystem.Setup(x => x.ReadAllText(@"C:\Dev\Non-Existent\test.sln")).Throws<FileNotFoundException>();
     
     var solutionParser = new SolutionParser(fileSystem.Object);
     solutionParser.GetProjectPaths(@"C:\Dev\Non-Existent\test.sln");
 }
All Usage Examples Of C24.ReVersion.SolutionParser::GetProjectPaths