Class XunitTestClass
Default implementation of IXunitTestClass for xUnit v3 tests based on reflection.
public class XunitTestClass : IXunitTestClass, ITestClass, ITestClassMetadata, IXunitSerializable
- Inheritance
-
XunitTestClass
- Implements
- Inherited Members
Constructors
XunitTestClass()
Called by the de-serializer; should only be called by deriving classes for de-serialization purposes
[Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")]
public XunitTestClass()
XunitTestClass(Type, IXunitTestCollection, string?)
Initializes a new instance of the XunitTestClass class.
public XunitTestClass(Type @class, IXunitTestCollection testCollection, string? uniqueID = null)
Parameters
classTypeThe test class
testCollectionIXunitTestCollectionThe test collection the class belongs to
uniqueIDstringThe unique ID for the test class (only used to override default behavior in testing scenarios)
Properties
BeforeAfterTestAttributes
Gets the IBeforeAfterTestAttributes attached to the test class (and the test collection and test assembly).
public IReadOnlyCollection<IBeforeAfterTestAttribute> BeforeAfterTestAttributes { get; }
Property Value
Class
Gets the type that this test class refers to.
public Type Class { get; }
Property Value
Remarks
This should only be used to execute a test class. All reflection should be abstracted here instead for better testability.
ClassFixtureTypes
Gets a list of class fixture types associated with the test class (and the test collection).
public IReadOnlyCollection<Type> ClassFixtureTypes { get; }
Property Value
Constructors
Gets the public constructors on the test class. If the test class is static, will return null.
public IReadOnlyCollection<ConstructorInfo>? Constructors { get; }
Property Value
Methods
Gets the public methods on the test class.
public IReadOnlyCollection<MethodInfo> Methods { get; }
Property Value
TestCaseOrderer
Gets the test case orderer for the test class, if present.
public ITestCaseOrderer? TestCaseOrderer { get; }
Property Value
TestClassName
Gets the full name of the test class (i.e., FullName).
public string TestClassName { get; }
Property Value
TestClassNamespace
Gets the namespace of the class where the test is defined. Will return null for
classes not residing in a namespace.
public string? TestClassNamespace { get; }
Property Value
TestClassSimpleName
Gets the simple name of the test class (the class name without namespace).
public string TestClassSimpleName { get; }
Property Value
TestCollection
Gets the test collection this test class belongs to.
public IXunitTestCollection TestCollection { get; }
Property Value
Traits
Gets the trait values associated with this test class (and the test collection, and test
assembly). If there are none, or the framework does not support traits, this returns an
empty dictionary (not null).
public IReadOnlyDictionary<string, IReadOnlyCollection<string>> Traits { get; }
Property Value
UniqueID
Gets the unique ID for this test class.
public string UniqueID { get; }
Property Value
Remarks
The unique identifier for a test class should be able to discriminate among test classes in the same test assembly. This identifier should remain stable until such time as the developer changes some fundamental part of the identity (assembly, collection, or test class). Recompilation of the test assembly is reasonable as a stability changing event.
Methods
Deserialize(IXunitSerializationInfo)
Called when the object should populate itself with data from the serialization info.
public void Deserialize(IXunitSerializationInfo info)
Parameters
infoIXunitSerializationInfoThe info to get the object data from
Serialize(IXunitSerializationInfo)
Called when the object should store its serialized values into the serialization info.
public void Serialize(IXunitSerializationInfo info)
Parameters
infoIXunitSerializationInfoThe info to store the object data into