Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit ea65d1b

Browse files
committed
Fixed the xunit converter tests
The tests were passing before because I was failing to await an async method. Changed the code to correctly await the Verify method and fixed up the failure.
1 parent 34f3516 commit ea65d1b

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

src/XUnitConverter.Tests/UsesXunitForTestsFormattingRuleTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private async Task Verify(string text, string expected, bool runFormatter = true
7272
}
7373

7474
[Fact]
75-
public void TestUpdatesUsingStatements()
75+
public async Task TestUpdatesUsingStatements()
7676
{
7777
var text = @"
7878
using System;
@@ -91,11 +91,11 @@ namespace System.Composition.UnitTests
9191
{
9292
}
9393
";
94-
Verify(text, expected);
94+
await Verify(text, expected);
9595
}
9696

9797
[Fact]
98-
public void TestUpdatesUsingStatementsWithIfDefs()
98+
public async Task TestUpdatesUsingStatementsWithIfDefs()
9999
{
100100
var text = @"
101101
using System;
@@ -120,11 +120,11 @@ namespace System.Composition.UnitTests
120120
{
121121
}
122122
";
123-
Verify(text, expected);
123+
await Verify(text, expected);
124124
}
125125

126126
[Fact]
127-
public void TestRemovesTestClassAttributes()
127+
public async Task TestRemovesTestClassAttributes()
128128
{
129129
var text = @"
130130
using System;
@@ -150,11 +150,11 @@ public class MyTestClass
150150
}
151151
}
152152
";
153-
Verify(text, expected);
153+
await Verify(text, expected);
154154
}
155155

156156
[Fact]
157-
public void TestUpdatesTestMethodAttributes()
157+
public async Task TestUpdatesTestMethodAttributes()
158158
{
159159
var text = @"
160160
using System;
@@ -187,11 +187,11 @@ public void MyTestMethod()
187187
}
188188
}
189189
";
190-
Verify(text, expected);
190+
await Verify(text, expected);
191191
}
192192

193193
[Fact]
194-
public void TestUpdatesAsserts()
194+
public async Task TestUpdatesAsserts()
195195
{
196196
var text = @"
197197
using System;
@@ -244,7 +244,7 @@ public void MyTestMethod()
244244
}
245245
}
246246
";
247-
Verify(text, expected);
247+
await Verify(text, expected);
248248
}
249249
}
250250
}

src/XUnitConverter.Tests/XUnitConverter.Tests.csproj

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@
7474
<Private>True</Private>
7575
<HintPath>..\packages\System.Collections.Immutable.1.1.32-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
7676
</Reference>
77+
<Reference Include="System.Composition.AttributedModel">
78+
<HintPath>..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
79+
</Reference>
80+
<Reference Include="System.Composition.Convention">
81+
<HintPath>..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
82+
</Reference>
83+
<Reference Include="System.Composition.Hosting">
84+
<HintPath>..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
85+
</Reference>
86+
<Reference Include="System.Composition.Runtime">
87+
<HintPath>..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
88+
</Reference>
89+
<Reference Include="System.Composition.TypedParts">
90+
<HintPath>..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
91+
</Reference>
7792
<Reference Include="System.Core" />
7893
<Reference Include="System.Reflection.Metadata">
7994
<HintPath>..\packages\System.Reflection.Metadata.1.0.17-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
@@ -101,6 +116,12 @@
101116
<None Include="app.config" />
102117
<None Include="packages.config" />
103118
</ItemGroup>
119+
<ItemGroup>
120+
<Content Include="..\XUnitConverter\MSTestNamespaces.txt">
121+
<Link>MSTestNamespaces.txt</Link>
122+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
123+
</Content>
124+
</ItemGroup>
104125
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
105126
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
106127
<PropertyGroup>
@@ -115,4 +136,4 @@
115136
<Target Name="AfterBuild">
116137
</Target>
117138
-->
118-
</Project>
139+
</Project>

src/XUnitConverter.Tests/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<package id="Microsoft.CodeAnalysis.VisualBasic" version="1.0.0.0-beta2" targetFramework="net45" />
88
<package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="1.0.0.0-beta2" targetFramework="net45" />
99
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0.0-beta2" targetFramework="net45" />
10+
<package id="Microsoft.Composition" version="1.0.30" targetFramework="net45" />
1011
<package id="System.Collections.Immutable" version="1.1.32-beta" targetFramework="net45" />
1112
<package id="System.Reflection.Metadata" version="1.0.17-beta" targetFramework="net45" />
1213
<package id="xunit" version="1.9.2" targetFramework="net45" />

0 commit comments

Comments
 (0)