From 436953744bc29e191d4a77b22351e1c204a089e9 Mon Sep 17 00:00:00 2001 From: Simon Weinberger Date: Sun, 20 Oct 2024 18:25:07 +0200 Subject: [PATCH] feat: set invariant culture before executing any test --- Yafc.Model.Tests/Data/DataUtils.cs | 3 --- Yafc.Model.Tests/PrepareForTests.cs | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 Yafc.Model.Tests/PrepareForTests.cs diff --git a/Yafc.Model.Tests/Data/DataUtils.cs b/Yafc.Model.Tests/Data/DataUtils.cs index 0be9da15..0d290946 100644 --- a/Yafc.Model.Tests/Data/DataUtils.cs +++ b/Yafc.Model.Tests/Data/DataUtils.cs @@ -1,6 +1,4 @@ using System; -using System.Globalization; -using System.Threading; using Xunit; namespace Yafc.Model.Data.Tests; @@ -8,7 +6,6 @@ namespace Yafc.Model.Data.Tests; public class DataUtilsTests { public DataUtilsTests() { Project.current = new(); - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; } [Fact] diff --git a/Yafc.Model.Tests/PrepareForTests.cs b/Yafc.Model.Tests/PrepareForTests.cs new file mode 100644 index 00000000..4ae2628c --- /dev/null +++ b/Yafc.Model.Tests/PrepareForTests.cs @@ -0,0 +1,16 @@ +using System.Globalization; +using System.Threading; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; +using Yafc.Model.Tests; + +[assembly: TestFramework("Yafc.Model.Tests." + nameof(PrepareForTests), "Yafc.Model.Tests")] + +namespace Yafc.Model.Tests; +public class PrepareForTests : XunitTestFramework { + public PrepareForTests(IMessageSink messageSink) + : base(messageSink) { + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + } +}