Table of Contents

Class ExtensibilityPointFactory

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

Represents a factory for the types used for extensibility throughout the system.

public static class ExtensibilityPointFactory
Inheritance
ExtensibilityPointFactory
Inherited Members

Methods

GetAssemblyBeforeAfterTestAttributes(Assembly)

Gets the IBeforeAfterTestAttributes attached to the given test assembly.

public static IReadOnlyCollection<IBeforeAfterTestAttribute> GetAssemblyBeforeAfterTestAttributes(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

IReadOnlyCollection<IBeforeAfterTestAttribute>

GetAssemblyFixtureTypes(Assembly)

Gets the fixture types that are attached to the test assembly via IAssemblyFixtureAttributes.

public static IReadOnlyCollection<Type> GetAssemblyFixtureTypes(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

IReadOnlyCollection<Type>

GetAssemblyTestCaseOrderer(Assembly)

Gets the test case orderer that's attached to a test assembly. Returns null if there isn't one attached.

public static ITestCaseOrderer? GetAssemblyTestCaseOrderer(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

ITestCaseOrderer

GetAssemblyTestCollectionOrderer(Assembly)

Gets the test collection orderer that's attached to a test assembly. Returns null if there isn't one attached.

public static ITestCollectionOrderer? GetAssemblyTestCollectionOrderer(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

ITestCollectionOrderer

GetAssemblyTraits(Assembly)

Gets the traits that are attached to the test assembly via ITraitAttributes.

public static IReadOnlyDictionary<string, IReadOnlyCollection<string>> GetAssemblyTraits(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

IReadOnlyDictionary<string, IReadOnlyCollection<string>>

GetClassBeforeAfterTestAttributes(Type, IReadOnlyCollection<IBeforeAfterTestAttribute>)

Gets the IBeforeAfterTestAttributes attached to the given test class.

public static IReadOnlyCollection<IBeforeAfterTestAttribute> GetClassBeforeAfterTestAttributes(Type testClass, IReadOnlyCollection<IBeforeAfterTestAttribute> collectionBeforeAfterAttributes)

Parameters

testClass Type

The test class

collectionBeforeAfterAttributes IReadOnlyCollection<IBeforeAfterTestAttribute>

The before after attributes from the test collection, to be merged into the result.

Returns

IReadOnlyCollection<IBeforeAfterTestAttribute>

GetClassClassFixtureTypes(Type, IReadOnlyCollection<Type>)

Gets the fixture types that are attached to the test class via IClassFixture<TFixture>.

public static IReadOnlyCollection<Type> GetClassClassFixtureTypes(Type testClass, IReadOnlyCollection<Type> collectionClassFixtureTypes)

Parameters

testClass Type

The test class

collectionClassFixtureTypes IReadOnlyCollection<Type>

The class fixture types from the test collection, which will be merged into the result

Returns

IReadOnlyCollection<Type>

GetClassTestCaseOrderer(Type)

Gets the test case orderer that's attached to a test class. Returns null if there isn't one attached.

public static ITestCaseOrderer? GetClassTestCaseOrderer(Type testClass)

Parameters

testClass Type

The test class

Returns

ITestCaseOrderer

GetClassTraits(Type?, IReadOnlyDictionary<string, IReadOnlyCollection<string>>?)

Gets the traits that are attached to the test class via ITraitAttributes.

public static IReadOnlyDictionary<string, IReadOnlyCollection<string>> GetClassTraits(Type? testClass, IReadOnlyDictionary<string, IReadOnlyCollection<string>>? testCollectionTraits)

Parameters

testClass Type

The test class

testCollectionTraits IReadOnlyDictionary<string, IReadOnlyCollection<string>>

The traits inherited from the test collection

Returns

IReadOnlyDictionary<string, IReadOnlyCollection<string>>

GetCollectionBeforeAfterTestAttributes(Type?, IReadOnlyCollection<IBeforeAfterTestAttribute>)

Gets the IBeforeAfterTestAttributes attached to the given test collection.

public static IReadOnlyCollection<IBeforeAfterTestAttribute> GetCollectionBeforeAfterTestAttributes(Type? collectionDefinition, IReadOnlyCollection<IBeforeAfterTestAttribute> assemblyBeforeAfterTestAttributes)

Parameters

collectionDefinition Type

The collection definition type

assemblyBeforeAfterTestAttributes IReadOnlyCollection<IBeforeAfterTestAttribute>

The before after attributes from the test assembly, to be merged into the result.

Returns

IReadOnlyCollection<IBeforeAfterTestAttribute>

GetCollectionBehavior(Assembly)

Gets the ICollectionBehaviorAttribute that's attached to the test assembly, if there is one.

public static ICollectionBehaviorAttribute? GetCollectionBehavior(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

ICollectionBehaviorAttribute

GetCollectionClassFixtureTypes(Type?)

Gets the fixture types that are attached to the test collection via IClassFixture<TFixture>.

public static IReadOnlyCollection<Type> GetCollectionClassFixtureTypes(Type? collectionDefinition)

Parameters

collectionDefinition Type

The test collection definition type

Returns

IReadOnlyCollection<Type>

GetCollectionCollectionFixtureTypes(Type?)

Gets the fixture types that are attached to the test collection via ICollectionFixture<TFixture>.

public static IReadOnlyCollection<Type> GetCollectionCollectionFixtureTypes(Type? collectionDefinition)

Parameters

collectionDefinition Type

The test collection definition type

Returns

IReadOnlyCollection<Type>

GetCollectionDefinitions(Assembly)

Gets the CollectionDefinitionAttributes that are attached to the test assembly. Verifies that there are no collection definitions with identical names.

public static IReadOnlyDictionary<string, (Type Type, CollectionDefinitionAttribute Attribute)> GetCollectionDefinitions(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly

Returns

IReadOnlyDictionary<string, (Type Type, CollectionDefinitionAttribute Attribute)>

GetCollectionTestCaseOrderer(Type?)

Gets the test case orderer that's attached to a test collection. Returns null if there isn't one attached.

public static ITestCaseOrderer? GetCollectionTestCaseOrderer(Type? collectionDefinition)

Parameters

collectionDefinition Type

The test collection definition

Returns

ITestCaseOrderer

GetCollectionTraits(Type?, IReadOnlyDictionary<string, IReadOnlyCollection<string>>?)

Gets the traits that are attached to the test collection via ITraitAttributes.

public static IReadOnlyDictionary<string, IReadOnlyCollection<string>> GetCollectionTraits(Type? testCollectionDefinition, IReadOnlyDictionary<string, IReadOnlyCollection<string>>? testAssemblyTraits)

Parameters

testCollectionDefinition Type

The test collection

testAssemblyTraits IReadOnlyDictionary<string, IReadOnlyCollection<string>>

The traits inherited from the test assembly

Returns

IReadOnlyDictionary<string, IReadOnlyCollection<string>>

GetMethodBeforeAfterTestAttributes(MethodInfo, IReadOnlyCollection<IBeforeAfterTestAttribute>)

Gets the IBeforeAfterTestAttributes attached to the given method.

public static IReadOnlyCollection<IBeforeAfterTestAttribute> GetMethodBeforeAfterTestAttributes(MethodInfo testMethod, IReadOnlyCollection<IBeforeAfterTestAttribute> classBeforeAfterAttributes)

Parameters

testMethod MethodInfo

The test method

classBeforeAfterAttributes IReadOnlyCollection<IBeforeAfterTestAttribute>

The before after attributes from the test class, to be merged into the result.

Returns

IReadOnlyCollection<IBeforeAfterTestAttribute>

GetMethodDataAttributes(MethodInfo)

Gets the IDataAttributes attached to the given test method.

public static IReadOnlyCollection<IDataAttribute> GetMethodDataAttributes(MethodInfo testMethod)

Parameters

testMethod MethodInfo

The test method

Returns

IReadOnlyCollection<IDataAttribute>

GetMethodFactAttributes(MethodInfo)

Gets the IFactAttributes attached to the given test method.

public static IReadOnlyCollection<IFactAttribute> GetMethodFactAttributes(MethodInfo testMethod)

Parameters

testMethod MethodInfo

The test method

Returns

IReadOnlyCollection<IFactAttribute>

GetMethodTraits(MethodInfo, IReadOnlyDictionary<string, IReadOnlyCollection<string>>?)

Gets the traits that are attached to the test method via ITraitAttributes.

public static IReadOnlyDictionary<string, IReadOnlyCollection<string>> GetMethodTraits(MethodInfo testMethod, IReadOnlyDictionary<string, IReadOnlyCollection<string>>? testClassTraits)

Parameters

testMethod MethodInfo

The test method

testClassTraits IReadOnlyDictionary<string, IReadOnlyCollection<string>>

The traits inherited from the test class

Returns

IReadOnlyDictionary<string, IReadOnlyCollection<string>>

GetTestFramework(Assembly)

Gets the test framework object for the given test assembly. It is important that callers to this function have called SetForInitialization(IMessageSink?, bool, bool) before calling this, so that the test framework and any ancillary helper classes have access to the diagnostic and internal diagnostic message sinks.

public static ITestFramework GetTestFramework(Assembly testAssembly)

Parameters

testAssembly Assembly

The test assembly to get the test framework for

Returns

ITestFramework

The test framework object

GetXunitTestCaseDiscoverer(Type)

Gets an xUnit.net v3 test discoverer.

public static IXunitTestCaseDiscoverer? GetXunitTestCaseDiscoverer(Type testCaseDiscovererType)

Parameters

testCaseDiscovererType Type

The test case discoverer type

Returns

IXunitTestCaseDiscoverer

GetXunitTestCollectionFactory(Type?, IXunitTestAssembly)

Gets an xUnit.net v3 test collection factory.

public static IXunitTestCollectionFactory? GetXunitTestCollectionFactory(Type? testCollectionFactoryType, IXunitTestAssembly testAssembly)

Parameters

testCollectionFactoryType Type

The test collection factory type

testAssembly IXunitTestAssembly

The test assembly under test

Returns

IXunitTestCollectionFactory

Get<TInterface>(Type?, object?[]?)

Gets an instance of the given type, casting it to TInterface, using the provided constructor arguments.

public static TInterface? Get<TInterface>(Type? type, object?[]? ctorArgs = null) where TInterface : class

Parameters

type Type

The implementation type.

ctorArgs object[]

The constructor arguments. Since diagnostic message sinks are optional, the code first looks for a type that takes the given arguments plus the message sink, and only falls back to the message sink-less constructor if none was found.

Returns

TInterface

The instance of the type.

Type Parameters

TInterface

The interface type.