public void TestInitialize() { var asm = Assembly.GetExecutingAssembly(); _resourcesPath = Path.Combine(Directory.GetParent(new Uri(asm.CodeBase).LocalPath).FullName, "Resources"); parser = new SolutionParser(); string solutionPath = Path.Combine(_resourcesPath, "SimpleSolution.sln"); parser.OnProject += OnProject; parser.Parse(solutionPath); }
/// <summary> /// Parses project file names from a solution file. /// </summary> /// <param name="solutionFile">Solution file name.</param> /// <returns>A list of project file names</returns> public ReadOnlyCollection <string> Parse(string solutionFile) { if (solutionFile == null) { throw new ArgumentNullException("solutionFile"); } List <string> projectFiles = new List <string>(); string extension = Path.GetExtension(solutionFile).TrimStart('.'); ISolutionParser parser = null; _parserMap.TryGetValue(extension, out parser); if (parser != null) { projectFiles.AddRange(parser.Parse(solutionFile)); } return(projectFiles.AsReadOnly()); }