Class Test
The Test abstract class represents a test within the framework.
public abstract class Test : ITest, IXmlNodeBuilder, IComparable
- Inheritance
-
Test
- Implements
- Derived
- Inherited Members
Constructors
Test(MethodInfo)
Construct a test from a MethodInfo
protected Test(MethodInfo method)
Parameters
method
MethodInfo
Test(string)
Constructs a test given its name
protected Test(string name)
Parameters
name
stringThe name of the test
Test(string, string)
Constructs a test given the path through the test hierarchy to its parent and a name.
protected Test(string pathName, string name)
Parameters
Test(Type)
TODO: Documentation needed for constructor
protected Test(Type fixtureType)
Parameters
fixtureType
Type
Fields
setUpMethods
The SetUp methods.
protected MethodInfo[] setUpMethods
Field Value
tearDownMethods
The teardown methods
protected MethodInfo[] tearDownMethods
Field Value
Properties
Fixture
Gets or sets a fixture object for running this test.
public object Fixture { get; set; }
Property Value
FixtureType
Gets the Type of the fixture used in running this test or null if no fixture type is associated with it.
public Type FixtureType { get; }
Property Value
FullName
Gets or sets the fully qualified name of the test
public string FullName { get; set; }
Property Value
HasChildren
Gets a bool indicating whether the current test has any descendant tests.
public abstract bool HasChildren { get; }
Property Value
Id
Gets or sets the id of the test
public int Id { get; set; }
Property Value
IsSuite
Returns true if this is a TestSuite
public bool IsSuite { get; }
Property Value
Method
Gets a MethodInfo for the method implementing this test. Returns null if the test is not implemented as a method.
public MethodInfo Method { get; set; }
Property Value
Name
Gets or sets the name of the test
public string Name { get; set; }
Property Value
Parent
Gets the parent as a Test object. Used by the core to set the parent.
public ITest Parent { get; set; }
Property Value
Properties
Gets the properties for this test
public IPropertyBag Properties { get; }
Property Value
RunState
Whether or not the test should be run
public RunState RunState { get; set; }
Property Value
Seed
Gets or Sets the Int value representing the seed for the RandomGenerator
public int Seed { get; set; }
Property Value
TestCaseCount
Gets a count of test cases represented by or contained under this test.
public virtual int TestCaseCount { get; }
Property Value
TestType
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 virtual string TestType { get; }
Property Value
Tests
Gets this test's child tests
public abstract IList<ITest> Tests { get; }
Property Value
XmlElementName
Gets the name used for the top-level element in the XML representation of this test
public abstract string XmlElementName { get; }
Property Value
Methods
AddToXml(XmlNode, bool)
Returns an XmlNode representing the current result after adding it as a child of the supplied parent node.
public abstract XmlNode AddToXml(XmlNode parentNode, bool recursive)
Parameters
Returns
ApplyAttributesToTest(ICustomAttributeProvider)
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(ICustomAttributeProvider provider)
Parameters
provider
ICustomAttributeProviderAn object implementing ICustomAttributeProvider
CompareTo(object)
Compares this test to another test for sorting purposes
public int CompareTo(object obj)
Parameters
obj
objectThe other test
Returns
- int
Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test
MakeTestResult()
Creates a TestResult for this test.
public abstract TestResult MakeTestResult()
Returns
- TestResult
A TestResult suitable for this type of test.
PopulateTestNode(XmlNode, bool)
Add standard attributes and members to a test node.
protected void PopulateTestNode(XmlNode thisNode, bool recursive)
Parameters
ToXml(bool)
Returns the Xml representation of the test
public XmlNode ToXml(bool recursive)
Parameters
recursive
boolIf true, include child tests recursively