Class MemberDataAttribute
Provides a data source for a data theory, with the data coming from one of the following sources:
- A static property
- A static field
- A static method (with parameters) The member must return something compatible with IEnumerable<object[]> with the test data. Caution: the property is completely enumerated by .ToList() before any test is run. Hence it should return independent object sets.
Inherited Members
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public sealed class MemberDataAttribute : MemberDataAttributeBase
Constructors
| Improve this Doc View SourceMemberDataAttribute(String, Object[])
Initializes a new instance of the MemberDataAttribute class.
Declaration
public MemberDataAttribute(string memberName, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
String | memberName | The name of the public static member on the test class that will provide the test data |
Object[] | parameters | The parameters for the member (only supported for methods; ignored for everything else) |
Methods
| Improve this Doc View SourceConvertDataItem(MethodInfo, Object)
Declaration
protected override object[] ConvertDataItem(MethodInfo testMethod, object item)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | testMethod | |
Object | item |
Returns
Type | Description |
---|---|
Object[] |