Skip to content

Commit 44a28a8

Browse files
authored
Replace xUnit with mstest (#1883)
xUnit is no longer able to run tests on UWP. MSTest supports this in Visual Studio 2022, so we are moving back to MSTest. (Rx used to used MSTest before, so this was a relatively straightforward change.) We had to make a few changes due to the fact that xUnit supplies a SynchronizationContext whereas MSTest does not. Also fixed a race condition in CreateAsyncTest.
1 parent 38e6196 commit 44a28a8

File tree

211 files changed

+4684
-4058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+4684
-4058
lines changed

AsyncRx.NET/Directory.build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</ItemGroup>
3232

3333
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
34-
<PackageReference Include="coverlet.collector" Version="3.1.0" />
34+
<PackageReference Include="coverlet.collector" Version="3.2.0" />
3535
</ItemGroup>
3636

3737
</Project>

Ix.NET/Source/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</ItemGroup>
3535

3636
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
37-
<PackageReference Include="coverlet.collector" Version="3.1.1" />
37+
<PackageReference Include="coverlet.collector" Version="3.2.0" />
3838
</ItemGroup>
3939

4040

Rx.NET/Integration/LinuxTests/LinuxTests.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
28-
<PackageReference Include="xunit" Version="2.4.1" />
29-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
30-
<PackageReference Include="System.Reactive" Version="5.1.0-preview*" />
31-
<PackageReference Include="Microsoft.Reactive.Testing" Version="5.1.0-preview*" />
32-
<PackageReference Include="System.Reactive.Observable.Aliases" Version="5.1.0-preview*" />
27+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
28+
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
29+
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
30+
<PackageReference Include="xunit.assert" Version="2.4.2" />
31+
<PackageReference Include="System.Reactive" Version="6.0.0-preview*" />
32+
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0-preview*" />
33+
<PackageReference Include="System.Reactive.Observable.Aliases" Version="6.0.0-preview*" />
3334
</ItemGroup>
3435
</Project>

Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
27-
<PackageReference Include="xunit" Version="2.4.1" />
28-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
29-
<PackageReference Include="System.Reactive" Version="5.1.0-preview*" />
30-
<PackageReference Include="Microsoft.Reactive.Testing" Version="5.1.0-preview*" />
31-
<PackageReference Include="System.Reactive.Observable.Aliases" Version="5.1.0-preview*" />
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
27+
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
28+
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
29+
<PackageReference Include="xunit.assert" Version="2.4.2" />
30+
<PackageReference Include="System.Reactive" Version="6.0.0-preview*" />
31+
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0-preview*" />
32+
<PackageReference Include="System.Reactive.Observable.Aliases" Version="6.0.0-preview*" />
3233
</ItemGroup>
3334
</Project>

Rx.NET/Source/CodeCoverage.runsettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
</DataCollector>
1414
</DataCollectors>
1515
</DataCollectionRunSettings>
16+
<MSTest>
17+
<TestTimeout>120000</TestTimeout>
18+
</MSTest>
1619
</RunSettings>

Rx.NET/Source/Directory.build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</ItemGroup>
3737

3838
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
39-
<PackageReference Include="coverlet.collector" Version="3.1.1" />
39+
<PackageReference Include="coverlet.collector" Version="3.2.0" />
4040
</ItemGroup>
4141

4242
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT License.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace Xunit.Sdk
6+
{
7+
/// <summary>
8+
/// Marker interface required by xUnit.
9+
/// </summary>
10+
/// <remarks>
11+
/// <para>
12+
/// The <c>xunit.assert.source</c> package normally includes this. However, unlike all the
13+
/// other types that package adds to our project, this one type is declared to be
14+
/// unconditionally public.
15+
/// </para>
16+
/// <para>
17+
/// We think this might be a bug: https://github.com/xunit/xunit/issues/2703
18+
/// </para>
19+
/// <para>
20+
/// In any case, we do not want our library to be exporting public types in the Xunit.Sdk
21+
/// namespace. So the csproj file carefully excludes the Asserts/Sdk/IAssertionException.cs
22+
/// file supplied by the package (which defines this type as <c>public</c>), and this file
23+
/// supplies an equivalent but <c>internal</c> definition.
24+
/// </para>
25+
/// </remarks>
26+
internal interface IAssertionException
27+
{
28+
}
29+
}

Rx.NET/Source/src/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
<PackageTags>Rx;Reactive;Extensions;Observable;LINQ;Events</PackageTags>
99
<Description>Reactive Extensions (Rx) for .NET - Testing Library</Description>
1010
<!-- NB: A lot of CA warnings are disabled because of the .cs files included from xunit.assert.source. -->
11-
<NoWarn>$(NoWarn);CA1305;CA1307;CA1032;CA1064;CA1822;CA1812</NoWarn>
11+
<NoWarn>$(NoWarn);IDE0054;IDE0066;CA1305;CA1307;CA1032;CA1064;CA1822;CA1812;CA1823</NoWarn>
1212
</PropertyGroup>
1313

1414
<ItemGroup>
1515
<EmbeddedResource Include="Properties\*.xml" />
16-
<PackageReference Include="xunit.assert.source" Version="2.4.1" PrivateAssets="All" />
16+
<PackageReference Include="xunit.assert.source" Version="2.4.2" PrivateAssets="All" />
1717
<ProjectReference Include="..\System.Reactive\System.Reactive.csproj" />
1818
</ItemGroup>
19+
20+
<ItemGroup>
21+
<!--
22+
Workaround for https://github.com/xunit/xunit/issues/2703
23+
-->
24+
<Compile Remove="$(NuGetPackageRoot)xunit.assert.source\**\contentFiles\cs\**\Asserts\Sdk\IAssertionException.cs" />
25+
</ItemGroup>
1926
</Project>

0 commit comments

Comments
 (0)