OrderAttribute
Defines the order that the test will run in
using NUnit.
Framework.
Interfaces;
using NUnit.
Framework.
Internal;
using System;
using System.
Runtime.
CompilerServices;
namespace NUnit.
Framework
{
[
AttributeUsage(
AttributeTargets.
Class |
AttributeTargets.
Method,
AllowMultiple =
false,
Inherited =
true)]
public class OrderAttribute :
NUnitAttribute,
IApplyToTest,
IApplyToTestSuite
{
public readonly int Order;
public OrderAttribute(
int order)
{
Order =
order;
}
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
public void ApplyToTest(
Test test)
{
if (!
test.
Properties.
ContainsKey(
"Order"))
test.
Properties.
Set(
"Order",
Order);
}
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
public void ApplyToTestSuite(
TestSuite testSuite)
{
if (!
testSuite.
Properties.
ContainsKey(
"Order"))
testSuite.
Properties.
Set(
"Order",
Order);
}
}
}