Skip to content

Commit

Permalink
Merge pull request unoplatform#16594 from Youssef1313/mstest
Browse files Browse the repository at this point in the history
test: Update MSTest and use meta package (which includes analyzers)
  • Loading branch information
jeromelaban authored May 13, 2024
2 parents 6637164 + a75145d commit 58ddd2f
Show file tree
Hide file tree
Showing 54 changed files with 80 additions and 67 deletions.
6 changes: 4 additions & 2 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@
<PackageReference Update="Uno.Diagnostics.Eventing" Version="2.0.1" />
<PackageReference Update="Uno.Wasm.Bootstrap" Version="8.0.0-dev.252" />
<PackageReference Update="Uno.Wasm.Bootstrap.DevServer" Version="8.0.0-dev.252" />
<PackageReference Update="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Update="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Update="MSTest" Version="3.3.1" />
<PackageReference Update="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Update="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Update="MSTest.Analyzers" Version="3.3.1" />
<PackageReference Update="Uno.MonoAnalyzers" Version="1.0.0" PrivateAssets="all" />
<PackageReference Update="Uno.Wasm.WebSockets" Version="1.1.0" />
<PackageReference Update="Microsoft.TypeScript.MSBuild" Version="4.3.5" />
Expand Down
3 changes: 2 additions & 1 deletion src/SamplesApp/SamplesApp.Skia/SamplesApp.Skia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
<PackageReference Include="IdentityModel.OidcClient" Version="3.1.2" />
<PackageReference Include="Microsoft.Graph" Version="3.12.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.47.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<!-- TODO: Use version 8 when compiling against .NET 8? -->
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.4-develop" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Uno.UI.Samples.Tests;

internal record TestCase
{
public object[] Parameters { get; init; } = Array.Empty<object>();
public object?[] Parameters { get; init; } = Array.Empty<object>();

public PointerDeviceType? Pointer { get; init; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Uno.UI.Samples.Tests;

internal record UnitTestMethodInfo
{
private readonly List<object[]> _casesParameters;
private readonly List<object?[]> _casesParameters;
private readonly IList<PointerDeviceType> _injectedPointerTypes;

private readonly bool _ignoredBecauseOfConditionalTestAttribute;
Expand Down
3 changes: 2 additions & 1 deletion src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
<PackageReference Include="IdentityModel.OidcClient" Version="3.1.2" />
<PackageReference Include="Microsoft.Graph" Version="3.12.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.47.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
Expand Down
3 changes: 2 additions & 1 deletion src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.4-develop" />
<PackageReference Include="Uno.Core.Extensions.Logging" Version="4.0.0-dev.7" />
<PackageReference Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.0-dev.7" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@
<Version>4.47.0</Version>
</PackageReference>

<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.0-dev.7" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="2.80.3" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/SamplesApp/UnoIslands.Skia/UnoIslands.Skia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<PackageReference Include="IdentityModel.OidcClient" Version="3.1.2" />
<PackageReference Include="Microsoft.Graph" Version="3.12.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.47.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<!-- TODO: Use version 8 when compiling against .NET 8? -->
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.4-develop" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="SkiaSharp.Views.WPF" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
<PackageReference Include="IdentityModel.OidcClient" Version="3.1.2" />
<PackageReference Include="Microsoft.Graph" Version="3.12.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.47.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<!-- TODO: Use version 8 when compiling against .NET 8? -->
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.4-develop" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="MSTest" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="4.8.0" />
Expand Down
4 changes: 1 addition & 3 deletions src/Uno.Analyzers.Tests/Uno.Analyzers.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="Microsoft.NET.Test.SDK" Version="17.8.0" />
<PackageReference Include="MSTest" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(CodeAnalysisVersionForAnalyzersTests)" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(CodeAnalysisVersionForAnalyzersTests)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(CodeAnalysisVersionForAnalyzersTests)" />
Expand Down
3 changes: 3 additions & 0 deletions src/Uno.UI.RuntimeTests/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project>
<PropertyGroup>
<NoWarn>$(NoWarn);MSTEST0010</NoWarn>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ namespace Windows.UI.Tests.Enterprise
public class AppBarIntegrationTests : BaseDxamlTestClass
{
[ClassInitialize]
public void ClassSetup()
public static void ClassSetup()
{
CommonTestSetupHelper.CommonTestClassSetup();
}

[ClassCleanup]
public void TestCleanup()
public static void TestCleanup()
{
TestServices.WindowHelper.VerifyTestCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Microsoft.UI.Xaml.Tests.Enterprise.CalendarDatePickerTests
public partial class CalendarDatePickerIntegrationTests : BaseDxamlTestClass
{
[ClassInitialize]
public void ClassSetup()
public static void ClassSetup()
{
CommonTestSetupHelper.CommonTestClassSetup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ internal AutomationPeer CallPeerFromProvider(IRawElementProviderSimple provider)
};

[ClassInitialize]
void ClassSetup()
public static void ClassSetup()
{
CommonTestSetupHelper.CommonTestClassSetup();
}

[ClassCleanup]
void TestCleanup()
public static void TestCleanup()
{
TestServices.WindowHelper.VerifyTestCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ private static string GetCurrentTimeZoneId()
}

[ClassInitialize]
void ClassSetup()
public static void ClassSetup()
{
CommonTestSetupHelper.CommonTestClassSetup();
}

[ClassCleanup]
void TestCleanup()
public static void TestCleanup()
{
TestServices.WindowHelper.VerifyTestCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ namespace Windows.UI.Tests.Enterprise
public class CommandBarIntegrationTests : BaseDxamlTestClass
{
[ClassInitialize]
void ClassSetup()
public static void ClassSetup()
{
CommonTestSetupHelper.CommonTestClassSetup();
}

[ClassCleanup]
void TestCleanup()
public static void TestCleanup()
{
TestServices.WindowHelper.ShutdownXaml();
TestServices.WindowHelper.VerifyTestCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="SkiaSharp" Version="2.88.7" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.7" />
<PackageReference Include="Uno.UI.RuntimeTests.Engine" Version="0.15.0-dev.56" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Uno.UI.RuntimeTests.Tests.HotReload;
#if !__SKIA__
[Ignore("Hot reload tests are only available on Skia targets")]
#endif
internal partial class Given_HotReloadWorkspace
public partial class Given_HotReloadWorkspace
{
private static Process? _process;
private static int _remoteControlPort;
Expand Down Expand Up @@ -167,6 +167,7 @@ public static async Task BuildTestApp()
"build",
$"-p:UnoRemoteControlPort={_remoteControlPort}",
$"-p:UnoRemoteControlHost=127.0.0.1",
$"-p:NoWarn=CS8619", // Workaround https://github.com/unoplatform/uno.ui.runtimetests.engine/issues/174#issuecomment-2104088957
"--configuration",

// Use the debug configuration so that remote control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls;

[TestClass]
[RunsOnUIThread]
internal class Given_NumberBox
public class Given_NumberBox
{
[TestMethod]
public async Task When_Fluent_And_Theme_Changed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Uno.UI.RuntimeTests.Tests.UnitTestsTests
{
[TestClass]
class Given_UnitTest
public class Given_UnitTest
{
static int When_UnhandledException_Count;

Expand All @@ -21,7 +21,7 @@ public void When_UnhandledException()
}

[TestClass]
class Given_UnitTest_Initialize
public class Given_UnitTest_Initialize
{
static int Initialize_Count;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Uno.UI.RuntimeTests.Tests.Windows_Foundation.Collections
{
[TestClass]
internal class Given_PropertySet
public class Given_PropertySet
{

PropertySet _testSet = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Uno.UI.RuntimeTests.Tests.Windows_Foundation.Collections
{
[TestClass]
internal class Given_StringMap
public class Given_StringMap
{

StringMap _testSet = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Uno.UI.RuntimeTests.Tests.Windows_Foundation.Collections
{
[TestClass]
internal class Given_ValueSet
public class Given_ValueSet
{

ValueSet _testSet = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public void When_AppMemoryUsage()
{
EnsureApiAvailable("AppMemoryUsage");

Assert.AreNotEqual(0, MemoryManager.AppMemoryUsage);
Assert.AreNotEqual<ulong>(0, MemoryManager.AppMemoryUsage);
}

[TestMethod]
public void When_AppMemoryUsageLimit()
{
EnsureApiAvailable("AppMemoryUsageLimit");

Assert.AreNotEqual(0, MemoryManager.AppMemoryUsageLimit);
Assert.AreNotEqual<ulong>(0, MemoryManager.AppMemoryUsageLimit);
}

private void EnsureApiAvailable(string propertyName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

[TestClass]
[RunsOnUIThread]
internal partial class Given_ExpressionAnimation
public partial class Given_ExpressionAnimation
{
[TestMethod]
public async Task When_Animating_Visual_Offset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

internal partial class Given_InteractionTracker
public partial class Given_InteractionTracker
{
private class TrackerAssertHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

internal partial class Given_InteractionTracker
public partial class Given_InteractionTracker
{
private static class TrackerLogsConstructingHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

internal partial class Given_InteractionTracker
public partial class Given_InteractionTracker
{
private sealed class TrackerOwner : IInteractionTrackerOwner
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

[TestClass]
[RunsOnUIThread]
internal partial class Given_InteractionTracker
public partial class Given_InteractionTracker
{
private static InteractionTracker SetupTracker(Compositor compositor)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Input_Preview_Injection;

[TestClass]
internal class Given_InputInjector
public class Given_InputInjector
{
[TestMethod]
[RunsOnUIThread]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public async Task When_Secondary_Window_Content_Non_Zero_Size()

[TestMethod]
[RunsOnUIThread]
public async void When_Secondary_Window_From_Xaml()
public async Task When_Secondary_Window_From_Xaml()
{
if (!NativeWindowFactory.SupportsMultipleWindows)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Automation
{
[TestClass]
class Given_AutomationPeer
public class Given_AutomationPeer
{
[TestMethod]
[RunsOnUIThread]
Expand Down
Loading

0 comments on commit 58ddd2f

Please sign in to comment.