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

Test

public abstract class Test : ITest, IXmlNodeBuilder, IComparable, IComparable<Test>
The Test abstract class represents a test within the framework.
public static string IdPrefix { get; set; }

Static prefix used for ids in this AppDomain. Set by FrameworkController.

public abstract object[] Arguments { get; }

The arguments to use in creating the test or empty array if none required.

public string ClassName { get; }

Gets the name of the class where this test was declared. Returns null if the test is not associated with a class.

public virtual object Fixture { get; set; }

Gets or sets a fixture object for running this test.

public string FullName { get; set; }

Gets or sets the fully qualified name of the test

public abstract bool HasChildren { get; }

Gets a bool indicating whether the current test has any descendant tests.

public string Id { get; set; }

Gets or sets the id of the test

public bool IsSuite { get; }

Returns true if this is a TestSuite

public IMethodInfo Method { get; set; }

Gets a MethodInfo for the method implementing this test. Returns null if the test is not implemented as a method.

public virtual string MethodName { get; }

Gets the name of the method implementing this test. Returns null if the test is not implemented as a method.

public string Name { get; set; }

Gets or sets the name of the test

public ITest Parent { get; set; }

Gets the parent as a Test object. Used by the core to set the parent.

public IPropertyBag Properties { get; }

Gets the properties for this test

public RunState RunState { get; set; }

Whether or not the test should be run

public int Seed { get; set; }

Gets or Sets the Int value representing the seed for the RandomGenerator

public IMethodInfo[] SetUpMethods { get; protected set; }

The SetUp methods.

public IMethodInfo[] TearDownMethods { get; protected set; }

The teardown methods

public virtual int TestCaseCount { get; }

Gets a count of test cases represented by or contained under this test.

public abstract IList<ITest> Tests { get; }

Gets this test's child tests

public virtual string TestType { get; }

Gets a string representing the type of test. Used as an attribute value in the XML representation of a test and has no other function in the framework.

public ITypeInfo TypeInfo { get; }

Gets the TypeInfo of the fixture used in running this test or null if no fixture type is associated with it.

public abstract string XmlElementName { get; }

Gets the name used for the top-level element in the XML representation of this test

protected Test(string name)

Constructs a test given its name

protected Test(string pathName, string name)

Constructs a test given the path through the test hierarchy to its parent and a name.

protected Test(ITypeInfo typeInfo)

Constructs a test for a specific type.

protected Test(IMethodInfo method)

Constructs a test for a specific method.

public abstract TNode AddToXml(TNode parentNode, bool recursive)

Returns an XmlNode representing the current result after adding it as a child of the supplied parent node.

Modify a newly constructed test by applying any of NUnit's common attributes, based on a supplied ICustomAttributeProvider, which is usually the reflection element from which the test was constructed, but may not be in some instances. The attributes retrieved are saved for use in subsequent operations.

public int CompareTo(object obj)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(Test other)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public virtual TAttr[] GetCustomAttributes<TAttr>(bool inherit)

Get custom attributes applied to a test

public void MakeInvalid(string reason)

Mark the test as Invalid (not runnable) specifying a reason

public abstract TestResult MakeTestResult()

Creates a TestResult for this test.

protected void PopulateTestNode(TNode thisNode, bool recursive)

Add standard attributes and members to a test node.

public TNode ToXml(bool recursive)

Returns the XML representation of the test