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

SetUICultureAttribute

Sets the current UI Culture for the duration of a test.

It may be specified at the level of a test or a fixture. The UI 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 SetUICultureAttribute : PropertyAttribute, IApplyToContext { private string _culture; public SetUICultureAttribute(string culture) : base("SetUICulture", culture) { _culture = culture; } void IApplyToContext.ApplyToContext(TestExecutionContext context) { context.CurrentUICulture = new CultureInfo(_culture, false); } } }