|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Roslyn.Services;
using System.IO;
namespace RoslynCodesearcher.Unittest
{
public static class TestHelper
{
public static List<IDocument> GetTestDocumentsCSharp()
{
List<IDocument> docs = new List<IDocument>();
return GetTestDocuments(TestConstants.SOLUTIONPATHCSHARP);
}
public static List<IDocument> GetTestDocumentsVB()
{
List<IDocument> docs = new List<IDocument>();
return GetTestDocuments(TestConstants.SOLUTIONPATHVB);
}
private static List<IDocument> GetTestDocuments(string solutionPath)
{
List<IDocument> docs = new List<IDocument>();
IWorkspace workspace = Workspace.LoadSolution(solutionPath);
ISolution solution = workspace.CurrentSolution;
foreach (IProject project in solution.Projects)
{
foreach (IDocument document in project.Documents)
{
docs.Add(document);
}
}
return docs;
}
public static IWorkspace GetTestWorkspaceCSharp()
{
return Workspace.LoadSolution(TestConstants.SOLUTIONPATHCSHARP);
}
public static IWorkspace GetTestWorkspaceVB()
{
return Workspace.LoadSolution(TestConstants.SOLUTIONPATHVB);
}
public static List<string> GetSolutions()
{
List<string> solutions = new List<string>();
solutions.Add(TestConstants.SOLUTIONPATHCSHARP);
return solutions;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.