Four App tests switched the process-wide UI language inside parallel classes, so another class's English assertion, or its constructor's reset to English, could land in the middle of them; they now live in the serial ArchiveLanguageTests and ImportLanguageTests. The App and Core test programs fail a test that leaves English outside a serial class at the switch, through the new TestContext.Current and TestContext.IsSerial. The FrameWindow cancellation test counted unobserved task exceptions while other classes ran beside it; it moves to the serial FrameWindowIsolationTests, and both unobserved-exception tests drain the finalizer queue before they start counting. The runner unwrapped TargetInvocationException only around the test method: a skip or an assertion thrown by a test class constructor or field initializer was reported as a failure reading "Exception has been thrown by the target of an invocation". Constructors are unwrapped the same way now. TestRunner.Discover(Type) and ExecuteAsync are public, so Tools.Tests checks the runner with nested fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
20 lines
799 B
C#
20 lines
799 B
C#
using Titano.Core.Localization;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.Core.Tests;
|
|
|
|
internal static class TestMain
|
|
{
|
|
public static Task<int> Main(string[] args)
|
|
{
|
|
// The UI language is process-wide: a test that leaves English outside a serial class races with the English
|
|
// assertions of the classes running beside it, so it fails at the switch instead of making another one flaky.
|
|
Loc.CultureChanged += (_, _) =>
|
|
{
|
|
if (TestContext.Current is { IsSerial: false } test && Loc.Culture.TwoLetterISOLanguageName != "en")
|
|
throw new AssertionException($"{test.TestName} switched the UI language to '{Loc.Culture.Name}' outside a [Serial] class");
|
|
};
|
|
return TestRunner.RunAsync(args, typeof(TestMain).Assembly);
|
|
}
|
|
}
|