Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Feb 15, 2021
1 parent 199ac1c commit 0bd8bd2
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions tests/TestUtility/OmniSharpTestHost.cs
Expand Up @@ -141,25 +141,40 @@ public IEnumerable<ProjectId> AddFilesToWorkspace(params TestFile[] testFiles)
public IEnumerable<ProjectId> AddFilesToWorkspace(string folderPath, params TestFile[] testFiles)
{
folderPath = folderPath ?? Directory.GetCurrentDirectory();
var csProjects = TestHelpers.AddProjectToWorkspace(
Workspace,
Path.Combine(folderPath, "project.csproj"),
new[] { "net472" },
testFiles.Where(f => f.FileName.EndsWith(".cs", StringComparison.OrdinalIgnoreCase)).ToArray());

var vbProjects = TestHelpers.AddProjectToWorkspace(
Workspace,
Path.Combine(folderPath, "project.vbproj"),
new[] { "net472" },
testFiles.Where(f => f.FileName.EndsWith(".vb", StringComparison.OrdinalIgnoreCase)).ToArray(),
languageName: LanguageNames.VisualBasic);

IEnumerable<ProjectId> projects = Enumerable.Empty<ProjectId>();
var csFiles = testFiles.Where(f => f.FileName.EndsWith(".cs", StringComparison.OrdinalIgnoreCase)).ToArray();
var vbFiles = testFiles.Where(f => f.FileName.EndsWith(".vb", StringComparison.OrdinalIgnoreCase)).ToArray();

if (csFiles.Length > 0)
{
projects.Concat(
TestHelpers.AddProjectToWorkspace(
Workspace,
Path.Combine(folderPath, "project.csproj"),
new[] { "net472" },
csFiles)
);
}

if (vbFiles.Length > 0)
{
projects.Concat(
TestHelpers.AddProjectToWorkspace(
Workspace,
Path.Combine(folderPath, "project.vbproj"),
new[] { "net472" },
vbFiles,
languageName: LanguageNames.VisualBasic)
);
}

foreach (var csxFile in testFiles.Where(f => f.FileName.EndsWith(".csx", StringComparison.OrdinalIgnoreCase)))
{
TestHelpers.AddCsxProjectToWorkspace(Workspace, csxFile);
}

return csProjects.Concat(vbProjects);
return projects;
}

public void ClearWorkspace()
Expand Down

0 comments on commit 0bd8bd2

Please sign in to comment.