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

RequiresThreadAttribute

Marks a test that must run on a separate thread.
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; using System.Threading; namespace NUnit.Framework { public abstract class IncludeExcludeAttribute : NUnitAttribute { private string include; private string exclude; private string reason; public string Include { get { return include; } set { include = value; } } public string Exclude { get { return exclude; } set { exclude = value; } } public string Reason { get { return reason; } set { reason = value; } } public IncludeExcludeAttribute() { } public IncludeExcludeAttribute(string include) { this.include = include; } } } namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class RequiresThreadAttribute : PropertyAttribute, IApplyToTest { public RequiresThreadAttribute() : base(true) { } public RequiresThreadAttribute(ApartmentState apartment) : base(true) { base.Properties.Add("ApartmentState", apartment); } void IApplyToTest.ApplyToTest(Test test) { test.RequiresThread = true; base.ApplyToTest(test); } } }