Skip to content

Commit 66605e8

Browse files
Merge pull request #236 from icsharpcode/233/fix-solution-tests
233/fix solution tests
2 parents 4b7c18c + cb57d04 commit 66605e8

8 files changed

Lines changed: 28 additions & 21 deletions

File tree

TestData/CSToVBCharacterization/ConvertSingleProject/EmptyVb/VisualBasicLibrary.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{6D723A94-7862-4FA1-923F-2C923E83158C}</ProjectGuid>
8-
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
8+
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
99
<OutputType>Library</OutputType>
1010
<RootNamespace>EmptyVb</RootNamespace>
1111
<AssemblyName>EmptyVb</AssemblyName>

TestData/CSToVBCharacterization/ConvertSolution/EmptyVb/VisualBasicLibrary.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{6D723A94-7862-4FA1-923F-2C923E83158C}</ProjectGuid>
8-
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
8+
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
99
<OutputType>Library</OutputType>
1010
<RootNamespace>EmptyVb</RootNamespace>
1111
<AssemblyName>EmptyVb</AssemblyName>

TestData/CharacterizationTestSolution/EmptyVb/VisualBasicLibrary.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{6D723A94-7862-4FA1-923F-2C923E83158C}</ProjectGuid>
8-
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
8+
<ProjectTypeGuids>{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
99
<OutputType>Library</OutputType>
1010
<RootNamespace>EmptyVb</RootNamespace>
1111
<AssemblyName>EmptyVb</AssemblyName>

TestData/VBToCSCharacterization/ConvertSingleProject/EmptyVb/VisualBasicLibrary.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{DF56BBFF-B43A-0050-1067-E6EC5C14212C}</ProjectGuid>
8-
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
99
<OutputType>Library</OutputType>
1010
<RootNamespace>EmptyVb</RootNamespace>
1111
<AssemblyName>EmptyVb</AssemblyName>

TestData/VBToCSCharacterization/ConvertSolution/EmptyVb/VisualBasicLibrary.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{DF56BBFF-B43A-0050-1067-E6EC5C14212C}</ProjectGuid>
8-
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
99
<OutputType>Library</OutputType>
1010
<RootNamespace>EmptyVb</RootNamespace>
1111
<AssemblyName>EmptyVb</AssemblyName>

Tests/CSharp/SolutionAndProjectTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ namespace CodeConverter.Tests.CSharp
1313
{
1414
public class SolutionAndProjectTests : ProjectConverterTestBase
1515
{
16-
[Fact(Skip = "Hits nullref on appveyor")]
17-
public void ConvertSolution()
16+
[Fact]
17+
public async Task ConvertSolution()
1818
{
19-
ConvertProjectsWhere<VBToCSConversion>(p => true);
19+
await ConvertProjectsWhere<VBToCSConversion>(p => true);
2020
}
2121

22-
[Fact(Skip = "Hits nullref on appveyor")]
23-
public void ConvertSingleProject()
22+
[Fact]
23+
public async Task ConvertSingleProject()
2424
{
25-
ConvertProjectsWhere<VBToCSConversion>(p => p.Name == "VisualBasicLibrary");
25+
await ConvertProjectsWhere<VBToCSConversion>(p => p.Name == "VisualBasicLibrary");
2626
}
2727
}
2828
}

Tests/TestRunners/ProjectConverterTestBase.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Reflection;
66
using System.Runtime.CompilerServices;
77
using System.Text;
8+
using System.Threading.Tasks;
89
using ICSharpCode.CodeConverter;
910
using ICSharpCode.CodeConverter.CSharp;
1011
using ICSharpCode.CodeConverter.Shared;
@@ -19,6 +20,7 @@ namespace CodeConverter.Tests.TestRunners
1920
/// For all files in the testdata folder relevant to the testname, ensures they match the result of the conversion.
2021
/// Any extra files generated by the conversion are ignored.
2122
/// </summary>
23+
[Collection("Uses MSBuild - everything using MSBuild must be in the same XUnit collection to avoid parallel builds which fail due to https://github.com/dotnet/roslyn/issues/30096")]
2224
public class ProjectConverterTestBase
2325
{
2426
/// <summary>
@@ -28,14 +30,18 @@ public class ProjectConverterTestBase
2830
/// </summary>
2931
private bool _writeNewCharacterization = false;
3032

31-
public void ConvertProjectsWhere<TLanguageConversion>(Func<Project, bool> shouldConvertProject, [CallerMemberName] string testName = "") where TLanguageConversion : ILanguageConversion, new()
33+
public async Task ConvertProjectsWhere<TLanguageConversion>(Func<Project, bool> shouldConvertProject, [CallerMemberName] string testName = "") where TLanguageConversion : ILanguageConversion, new()
3234
{
33-
using (var workspace = MSBuildWorkspace.Create())
35+
using (var workspace = MSBuildWorkspace.Create(new Dictionary<string, string>()
36+
{
37+
{"Configuration", "Debug"},
38+
{"Platform", "AnyCPU"}
39+
}))
3440
{
3541
var originalSolutionDir = Path.Combine(GetTestDataDirectory(), "CharacterizationTestSolution");
3642
var solutionFile = Path.Combine(originalSolutionDir, "CharacterizationTestSolution.sln");
3743

38-
var solution = workspace.OpenSolutionAsync(solutionFile).GetAwaiter().GetResult();
44+
var solution = await workspace.OpenSolutionAsync(solutionFile);
3945
var languageNameToConvert = typeof(TLanguageConversion) == typeof(VBToCSConversion)
4046
? LanguageNames.VisualBasic
4147
: LanguageNames.CSharp;
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
using CodeConverter.Tests.TestRunners;
1+
using System.Threading.Tasks;
2+
using CodeConverter.Tests.TestRunners;
23
using ICSharpCode.CodeConverter.VB;
34
using Xunit;
45

56
namespace CodeConverter.Tests.VB
67
{
78
public class SolutionAndProjectTests : ProjectConverterTestBase
89
{
9-
[Fact(Skip = "Hits nullref on appveyor")]
10-
public void ConvertSolution()
10+
[Fact]
11+
public async Task ConvertSolution()
1112
{
12-
ConvertProjectsWhere<CSToVBConversion>(p => true);
13+
await ConvertProjectsWhere<CSToVBConversion>(p => true);
1314
}
1415

15-
[Fact(Skip = "Hits nullref on appveyor")]
16-
public void ConvertSingleProject()
16+
[Fact]
17+
public async Task ConvertSingleProject()
1718
{
18-
ConvertProjectsWhere<CSToVBConversion>(p => p.Name == "CSharpConsoleApp");
19+
await ConvertProjectsWhere<CSToVBConversion>(p => p.Name == "CSharpConsoleApp");
1920
}
2021
}
2122
}

0 commit comments

Comments
 (0)