Skip to content

Commit af32a51

Browse files
authored
Start using System.Private.Windows.Core.TestUtilities (#10104)
* Add System.Private.Windows.Core.TestUtilities package reference and bump xunit version * Test private field SplashScreen._resourceName using TestAccessor
1 parent 7d9f5ae commit af32a51

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

eng/Versions.props

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
</PropertyGroup>
8585
<!-- XUnit-related (not extensions) -->
8686
<PropertyGroup>
87-
<XUnitVersion>2.9.0</XUnitVersion>
87+
<XUnitVersion>2.9.2</XUnitVersion>
8888
<XUnitAssertVersion>$(XUnitVersion)</XUnitAssertVersion>
8989
<XUnitRunnerConsoleVersion>$(XUnitVersion)</XUnitRunnerConsoleVersion>
9090
<XUnitRunnerVisualStudioVersion>2.8.1</XUnitRunnerVisualStudioVersion>
@@ -99,6 +99,8 @@
9999
<SystemDrawingCommonTestDataVersion>8.0.0-beta.23107.1</SystemDrawingCommonTestDataVersion>
100100
<SystemWindowsExtensionsTestDataVersion>8.0.0-beta.23107.1</SystemWindowsExtensionsTestDataVersion>
101101
<VerifyXunitVersion>14.2.0</VerifyXunitVersion>
102+
<!-- Shared test utilities with WinForms -->
103+
<SystemPrivateWindowsCoreTestUtilitiesVersion>10.0.0-alpha.1.24571.3</SystemPrivateWindowsCoreTestUtilitiesVersion>
102104
</PropertyGroup>
103105
<!-- Code Coverage -->
104106
<PropertyGroup>

src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/BinaryFormat/ArrayTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
namespace PresentationCore.Tests.BinaryFormat;
55

66
public class ArrayTests
77
{
8-
public static TheoryData<string?[]> StringArray_Parse_Data => new()
8+
public static TheoryData<Array> StringArray_Parse_Data => new()
99
{
1010
new string?[] { "one", "two" },
1111
new string?[] { "yes", "no", null },
@@ -20,7 +20,7 @@ public class ArrayTests
2020
new DateTime[] { DateTime.MaxValue }
2121
};
2222

23-
public static IEnumerable<object[]> Array_TestData => StringArray_Parse_Data.Concat(PrimitiveArray_Parse_Data);
23+
public static IEnumerable<object[]> Array_TestData => ((IEnumerable<object[]>)StringArray_Parse_Data).Concat(PrimitiveArray_Parse_Data);
2424

2525
public static TheoryData<Array> Array_UnsupportedTestData => new()
2626
{

src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/BinaryFormat/BinaryFormatWriterTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections;
@@ -102,15 +102,15 @@ public void BinaryFormatWriter_TryWriteObject_UnsupportedObjects_RoundTrip(objec
102102
}
103103

104104
public static IEnumerable<object[]?> TryWriteObject_SupportedObjects_TestData =>
105-
HashtableTests.Hashtables_TestData.Concat(
105+
((IEnumerable<object[]?>)HashtableTests.Hashtables_TestData).Concat(
106106
ListTests.PrimitiveLists_TestData).Concat(
107107
ListTests.ArrayLists_TestData).Concat(
108108
PrimitiveTypeTests.Primitive_Data).Concat(
109109
SystemDrawingTests.SystemDrawing_TestData).Concat(
110110
ArrayTests.Array_TestData);
111111

112112
public static IEnumerable<object[]?> TryWriteObject_UnsupportedObjects_TestData =>
113-
HashtableTests.Hashtables_UnsupportedTestData.Concat(
113+
((IEnumerable<object[]?>)HashtableTests.Hashtables_UnsupportedTestData).Concat(
114114
ListTests.Lists_UnsupportedTestData).Concat(
115115
ListTests.ArrayLists_UnsupportedTestData).Concat(
116116
ArrayTests.Array_UnsupportedTestData);

src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/System/Windows/SplashScreenTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public void Constructor_NullImageSource_ThrowsArgumentNullException()
1515
public void Create()
1616
{
1717
SplashScreen splash = new(typeof(SplashScreenTests).Assembly, "Needle");
18+
string resourceName = splash.TestAccessor().Dynamic._resourceName;
19+
resourceName.Should().Be("needle");
1820
splash.Show(autoClose: true);
1921
}
2022
}

src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/WindowsBase.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
1313
<PackageReference Include="xunit.stafact" Version="$(XUnitStaFactPackageVersion)" />
1414
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerPackageVersion)" />
15+
<PackageReference Include="System.Private.Windows.Core.TestUtilities" Version="$(SystemPrivateWindowsCoreTestUtilitiesVersion)" />
1516
</ItemGroup>
1617

1718
<ItemGroup>

0 commit comments

Comments
 (0)