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

SingleThreadedAttribute

SingleThreadedAttribute applies to a test fixture and indicates that all the child tests must be run on the same thread as the OneTimeSetUp and OneTimeTearDown. It sets a flag in the TestExecutionContext and forces all tests to be run sequentially on the current thread. Any ParallelScope setting is ignored.
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class SingleThreadedAttribute : NUnitAttribute, IApplyToContext { public void ApplyToContext(TestExecutionContext context) { context.IsSingleThreaded = true; } } }