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

SingleThreadedAttribute

Marks a test fixture as requiring all child tests to be run on the same thread as the OneTimeSetUp and OneTimeTearDown. A flag in the TestExecutionContext is set forcing all child tests to be run sequentially on the current thread. Any ParallelScope setting is ignored.
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; using System.Runtime.CompilerServices; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class SingleThreadedAttribute : NUnitAttribute, IApplyToContext { [System.Runtime.CompilerServices.NullableContext(1)] public void ApplyToContext(TestExecutionContext context) { context.IsSingleThreaded = true; } } }