Constructor MemberDataAttribute
- Namespace
- Xunit
- Assembly
- xunit.v3.core.dll
MemberDataAttribute(string, params object?[])
Provides a data source for a data theory, with the data coming from one of the following sources:
- A public static property
- A public static field
- A public static method (with parameters)
public MemberDataAttribute(string memberName, params object?[] arguments)
Parameters
memberName
stringThe name of the public static member on the test class that will provide the test data It is recommended to use the
nameof
operator to ensure compile-time safety, e.g.,nameof(SomeMemberName)
.arguments
object[]The arguments to be passed to the member (only supported for methods; ignored for everything else)
Remarks
The member must return data in a form that is compatible, which means collections of object?[]
,
ITheoryDataRow
, or tuple values. Those collections may come via IEnumerable<T> or
IAsyncEnumerable<T>, and those collections may optionally be wrapped in either
Task<TResult> or ValueTask<TResult>.