profileShare

rasmusjy / splitapp-backend-clean-onion

Read-only snapshot

No repository description.

main default branch 429 files Expires Sep 13, 2026, 9:06 AM
GlobalTestInit.cs 868 bytes
1 using System.Globalization;
2 using System.Runtime.CompilerServices;
3
4 namespace App.Tests;
5
6 /// <summary>
7 /// Sets the default thread culture before any test runs. Linux Docker containers
8 /// default to Invariant culture (CurrentUICulture.Name == ""), which makes
9 /// `new LangStr("Food")` throw "Culture is required!" because LangStr derives the
10 /// culture from Thread.CurrentThread.CurrentUICulture.Name. Locally on Windows
11 /// this never fires because Windows always has a non-empty culture.
12 /// </summary>
13 internal static class GlobalTestInit
14 {
15 [ModuleInitializer]
16 public static void Init()
17 {
18 var en = new CultureInfo("en");
19 CultureInfo.DefaultThreadCurrentCulture = en;
20 CultureInfo.DefaultThreadCurrentUICulture = en;
21 Thread.CurrentThread.CurrentCulture = en;
22 Thread.CurrentThread.CurrentUICulture = en;
23 }
24 }
25