<PackageReference Include="NUnit" Version="3.0.0-beta-3" />

Test

public abstract class Test : ITest, IXmlNodeBuilder, IComparable
The Test abstract class represents a test within the framework.
using NUnit.Framework.Interfaces; using System; using System.Collections.Generic; using System.Reflection; namespace NUnit.Framework.Internal { public abstract class Test : ITest, IXmlNodeBuilder, IComparable { private static int _nextID = 1000; protected MethodInfo[] setUpMethods; protected MethodInfo[] tearDownMethods; public string Id { get; set; } public string Name { get; set; } public string FullName { get; set; } public string ClassName { get { Type type = FixtureType; if (type == (Type)null) return null; if (type.IsGenericType) type = type.GetGenericTypeDefinition(); return type.FullName; } } public virtual string MethodName => null; public Type FixtureType { get; set; } public MethodInfo Method { get; set; } public RunState RunState { get; set; } public abstract string XmlElementName { get; } public virtual string TestType => GetType().Name; public virtual int TestCaseCount => 1; public IPropertyBag Properties { get; set; } public bool IsSuite => this is TestSuite; public abstract bool HasChildren { get; } public ITest Parent { get; set; } public abstract IList<ITest> Tests { get; } public virtual object Fixture { get; set; } public static string IdPrefix { get; set; } public int Seed { get; set; } internal bool RequiresThread { get; set; } internal bool IsAsynchronous { get; set; } protected Test(string name) { FullName = name; Name = name; Id = GetNextId(); Properties = new PropertyBag(); RunState = RunState.Runnable; } protected Test(string pathName, string name) { FullName = ((pathName == null || pathName == string.Empty) ? name : (pathName + "." + name)); Name = name; Id = GetNextId(); Properties = new PropertyBag(); RunState = RunState.Runnable; } protected Test(Type fixtureType) : this(fixtureType.FullName) { FixtureType = fixtureType; } protected Test(MethodInfo method) : this(method.ReflectedType) { Name = method.Name; FullName = FullName + "." + Name; Method = method; } private static string GetNextId() { return IdPrefix + _nextID++.ToString(); } public abstract TestResult MakeTestResult(); public void ApplyAttributesToTest(ICustomAttributeProvider provider) { object[] customAttributes = provider.GetCustomAttributes(typeof(IApplyToTest), true); for (int i = 0; i < customAttributes.Length; i++) { ((IApplyToTest)customAttributes[i]).ApplyToTest(this); } } protected void PopulateTestNode(TNode thisNode, bool recursive) { thisNode.AddAttribute("id", Id.ToString()); thisNode.AddAttribute("name", Name); thisNode.AddAttribute("fullname", FullName); if (MethodName != null) thisNode.AddAttribute("methodname", MethodName); if (ClassName != null) thisNode.AddAttribute("classname", ClassName); thisNode.AddAttribute("runstate", RunState.ToString()); if (Properties.Keys.Count > 0) Properties.AddToXml(thisNode, recursive); } public TNode ToXml(bool recursive) { return AddToXml(new TNode("dummy"), recursive); } public abstract TNode AddToXml(TNode parentNode, bool recursive); public int CompareTo(object obj) { Test test = obj as Test; if (test == null) return -1; return FullName.CompareTo(test.FullName); } } }