Class MemberDataAttributeBase
Provides a base class for attributes that will provide member data. The member data must return
something compatible with
Inherited Members
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public abstract class MemberDataAttributeBase : DataAttribute
Constructors
| Improve this Doc View SourceMemberDataAttributeBase(String, Object[])
Initializes a new instance of the MemberDataAttributeBase class.
Declaration
protected MemberDataAttributeBase(string memberName, 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) |
Properties
| Improve this Doc View SourceDisableDiscoveryEnumeration
Returns true
if the data attribute wants to skip enumerating data during discovery.
This will cause the theory to yield a single test case for all data, and the data discovery
will be during test execution instead of discovery.
Declaration
public bool DisableDiscoveryEnumeration { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
MemberName
Gets the member name.
Declaration
public string MemberName { get; }
Property Value
Type | Description |
---|---|
String |
MemberType
Gets or sets the type to retrieve the member from. If not set, then the property will be retrieved from the unit test class.
Declaration
public Type MemberType { get; set; }
Property Value
Type | Description |
---|---|
Type |
Parameters
Gets or sets the parameters passed to the member. Only supported for static methods.
Declaration
public object[] Parameters { get; }
Property Value
Type | Description |
---|---|
Object[] |
Methods
| Improve this Doc View SourceConvertDataItem(MethodInfo, Object)
Converts an item yielded by the data member to an object array, for return from GetData(MethodInfo).
Declaration
protected abstract object[] ConvertDataItem(MethodInfo testMethod, object item)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | testMethod | The method that is being tested. |
Object | item | An item yielded from the data member. |
Returns
Type | Description |
---|---|
Object[] | An object[] suitable for return from GetData(MethodInfo). |
GetData(MethodInfo)
Declaration
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | testMethod |
Returns
Type | Description |
---|---|
IEnumerable<Object[]> |