Interface IXunitTestMethod
Represents a test class from xUnit.net v3 based on reflection.
public interface IXunitTestMethod : ITestMethod, ITestMethodMetadata
- Inherited Members
Properties
BeforeAfterTestAttributes
Gets the IBeforeAfterTestAttributes attached to the test method (and the test class, test collection, and test assembly).
IReadOnlyCollection<IBeforeAfterTestAttribute> BeforeAfterTestAttributes { get; }
Property Value
DataAttributes
Gets the IDataAttributes attached to the test method.
IReadOnlyCollection<IDataAttribute> DataAttributes { get; }
Property Value
FactAttributes
Gets the IFactAttributes attached to the test method.
IReadOnlyCollection<IFactAttribute> FactAttributes { get; }
Property Value
IsGenericMethodDefinition
Gets a flag which indicates whether this is a generic method definition.
bool IsGenericMethodDefinition { get; }
Property Value
Method
Gets the method that this test method refers to.
MethodInfo Method { get; }
Property Value
Remarks
This should only be used to execute a test method. All reflection should be abstracted here instead for better testability.
Parameters
Gets the parameters of the test method.
IReadOnlyCollection<ParameterInfo> Parameters { get; }
Property Value
ReturnType
Gets the return type of the test method.
Type ReturnType { get; }
Property Value
TestClass
Gets the test class that this test method belongs to.
IXunitTestClass TestClass { get; }
Property Value
TestMethodArguments
Gets the arguments that will be passed to the test method.
object?[] TestMethodArguments { get; }
Property Value
- object[]
Methods
GetDisplayName(string, object?[]?, Type[]?)
Gets the display name for the test method, factoring in arguments and generic types.
string GetDisplayName(string baseDisplayName, object?[]? testMethodArguments, Type[]? methodGenericTypes)
Parameters
baseDisplayNamestringThe base display name.
testMethodArgumentsobject[]The test method arguments.
methodGenericTypesType[]The generic types of the method.
Returns
MakeGenericMethod(Type[])
Creates a generic version of the test method with the given generic types.
MethodInfo MakeGenericMethod(Type[] genericTypes)
Parameters
genericTypesType[]The generic types
Returns
ResolveGenericTypes(object?[])
Resolves the generic types for the test method given the method's arguments. If the method
is not generic, will return null.
Type[]? ResolveGenericTypes(object?[] arguments)
Parameters
argumentsobject[]The method arguments
Returns
- Type[]
ResolveMethodArguments(object?[])
Resolves argument values for the test method, ensuring they are the correct type, including support for optional method arguments.
object?[] ResolveMethodArguments(object?[] arguments)
Parameters
argumentsobject[]The test method arguments
Returns
- object[]