ParallelizableAttribute
ParallelizableAttribute is used to mark tests that may be run in parallel.
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using System;
namespace NUnit.Framework
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ParallelizableAttribute : PropertyAttribute, IApplyToContext
{
private ParallelScope _scope;
public ParallelizableAttribute()
: this(ParallelScope.Self)
{
}
public ParallelizableAttribute(ParallelScope scope)
{
_scope = scope;
base.Properties.Add("ParallelScope", scope);
}
public void ApplyToContext(TestExecutionContext context)
{
context.ParallelScope = (_scope & ~ParallelScope.Self);
}
}
}