<PackageReference Include="NUnit" Version="3.10.0" />

SetCultureAttribute

Sets the current Culture for the duration of a test.

It may be specified at the level of a test or a fixture. The culture remains set until the test or fixture completes and is then reset to its original value.

using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; using System.Globalization; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class SetCultureAttribute : PropertyAttribute, IApplyToContext { private string _culture; public SetCultureAttribute(string culture) : base("SetCulture", culture) { _culture = culture; } void IApplyToContext.ApplyToContext(TestExecutionContext context) { context.CurrentCulture = new CultureInfo(_culture, false); } } }