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
56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
using System.Globalization;
|
|
using Titano.App.Import;
|
|
using Titano.Core.Localization;
|
|
using Titano.Testing;
|
|
using static Titano.App.Tests.Import.CardPoolTests;
|
|
using static Titano.App.Tests.Import.ImportPlansTests;
|
|
|
|
namespace Titano.App.Tests.Import;
|
|
|
|
/// <summary>
|
|
/// Import texts in a right-to-left language. They switch the process-wide UI language, so the class is serial: in
|
|
/// parallel it would race with the English assertions of the classes running beside it.
|
|
/// </summary>
|
|
[Serial]
|
|
public sealed class ImportLanguageTests
|
|
{
|
|
public ImportLanguageTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
|
|
|
[Test]
|
|
public void PathsAndSerialsStayLeftToRightInARightToLeftLanguage()
|
|
{
|
|
try
|
|
{
|
|
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
|
|
var pool = CardPool.Build([Usb with { Label = string.Empty }, CardA], [], @"D:\Shoots\");
|
|
Assert.Equal("\u202AG:\\\u202C", pool[1].Title, "a drive root keeps its separator at its end");
|
|
Assert.Equal("\u202AD:\\Shoots\\\u202C", pool[2].Title);
|
|
Assert.Equal("\u202AD:\\Shoots\\\u202C", pool[2].Subtitle);
|
|
Assert.Contains("\u202A3F2A-9C11\u202C", pool[0].IdentityText);
|
|
Assert.Equal("EOS_DIGITAL", pool[0].Title, "a label is left to bidi");
|
|
}
|
|
finally
|
|
{
|
|
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void ARightToLeftLanguageReadsTheSessionTimesWithItsOwnArrow()
|
|
{
|
|
var plan = ThreeSessions();
|
|
Assert.Contains("→", ImportPlans.Sessions(plan, ImportDestinationKind.Archive, new HashSet<string>())[0].TimeText);
|
|
try
|
|
{
|
|
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
|
|
var time = ImportPlans.Sessions(plan, ImportDestinationKind.Archive, new HashSet<string>())[0].TimeText;
|
|
Assert.Contains("←", time);
|
|
Assert.False(time.Contains('→'), "a right-to-left reader would see the arrow point back to the start");
|
|
}
|
|
finally
|
|
{
|
|
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
|
}
|
|
}
|
|
}
|