Class XunitTestCollection
The default implementation of IXunitTestCollection for xUnit.net v3.
public class XunitTestCollection : IXunitTestCollection, ITestCollection, ITestCollectionMetadata, IXunitSerializable
- Inheritance
-
XunitTestCollection
- Implements
- Inherited Members
Constructors
XunitTestCollection()
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 XunitTestCollection()
XunitTestCollection(IXunitTestAssembly, Type?, bool, string, string?)
Initializes a new instance of the XunitTestCollection class.
public XunitTestCollection(IXunitTestAssembly testAssembly, Type? collectionDefinition, bool disableParallelization, string displayName, string? uniqueID = null)
Parameters
testAssemblyIXunitTestAssemblyThe test assembly the collection belongs to
collectionDefinitionTypeThe optional type which contains the collection definition
disableParallelizationboolA flag to indicate whether this test collection opts out of parallelization
displayNamestringThe display name for the test collection
uniqueIDstringThe unique ID for the test collection (only used to override default behavior in testing scenarios)
Properties
BeforeAfterTestAttributes
Gets the IBeforeAfterTestAttributes attached to the test collection (and the test assembly).
public IReadOnlyCollection<IBeforeAfterTestAttribute> BeforeAfterTestAttributes { get; }
Property Value
ClassFixtureTypes
Gets a list of collection fixture types associated with the test collection.
public IReadOnlyCollection<Type> ClassFixtureTypes { get; }
Property Value
CollectionDefinition
Gets the type that this collection definition derived from, if it derives from one. Untyped collections are possible when test classes are decorated using CollectionAttribute(string) and there is no test collection class declared with the same name.
public Type? CollectionDefinition { get; }
Property Value
Remarks
This should only be used to execute a test collection. All reflection should be abstracted here instead for better testability.
CollectionFixtureTypes
Gets a list of collection fixture types associated with the test collection.
public IReadOnlyCollection<Type> CollectionFixtureTypes { get; }
Property Value
DisableParallelization
Determines whether tests in this collection runs in parallel with any other collections.
public bool DisableParallelization { get; }
Property Value
TestAssembly
Gets the test assembly this test collection belongs to.
public IXunitTestAssembly TestAssembly { get; }
Property Value
TestCaseOrderer
Gets the test case orderer for the test collection, if present.
public ITestCaseOrderer? TestCaseOrderer { get; }
Property Value
TestCollectionClassName
Gets the type that the test collection was defined with, if available; may be null
if the test collection didn't have a definition type.
public string? TestCollectionClassName { get; }
Property Value
TestCollectionDisplayName
Gets the display name of the test collection.
public string TestCollectionDisplayName { get; }
Property Value
Traits
Gets the trait values associated with this test collection (and the 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 collection.
public string UniqueID { get; }
Property Value
Remarks
The unique identifier for a test collection should be able to discriminate among test collections in the same test assembly. This identifier should remain stable until such time as the developer changes some fundamental part of the identity (the test assembly, the collection definition class, or the collection name). 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