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

Test

public abstract class Test : ITest, IXmlNodeBuilder, IComparable
The Test abstract class represents a test within the framework.

Used to cache the declaring type for this MethodInfo

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 MethodInfo[] SetUpMethods { get; protected set; }

The SetUp methods.

public MethodInfo[] 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)

TODO: Documentation needed for constructor

protected Test(IMethodInfo method)

Construct a test from a MethodInfo

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.

public void ApplyAttributesToTest(MemberInfo provider)

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 void ApplyAttributesToTest(Assembly provider)

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 this test to another test for sorting purposes

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