xUnit.net
Public Member Functions | Protected Member Functions | List of all members
Xunit.MemberDataAttribute Class Reference

Provides a data source for a data theory, with the data coming from one of the following sources: More...

Inheritance diagram for Xunit.MemberDataAttribute:
Xunit.MemberDataAttributeBase Xunit.Sdk.DataAttribute

Public Member Functions

 MemberDataAttribute (string memberName, params object[] parameters)
 Initializes a new instance of the MemberDataAttribute class. More...
 
- Public Member Functions inherited from Xunit.MemberDataAttributeBase
override IEnumerable< object[]> GetData (MethodInfo testMethod)
 Returns the data to be used to test the theory.
 

Protected Member Functions

override object [] ConvertDataItem (MethodInfo testMethod, object item)
 Converts an item yielded by the data member to an object array, for return from GetData.
 
- Protected Member Functions inherited from Xunit.MemberDataAttributeBase
 MemberDataAttributeBase (string memberName, object[] parameters)
 Initializes a new instance of the MemberDataAttributeBase class. More...
 

Additional Inherited Members

- Properties inherited from Xunit.MemberDataAttributeBase
bool DisableDiscoveryEnumeration [get, set]
 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. More...
 
string MemberName [get]
 Gets the member name. More...
 
Type MemberType [get, set]
 Gets or sets the type to retrieve the member from. If not set, then the property will be retrieved from the unit test class. More...
 
object [] Parameters [get]
 Gets or sets the parameters passed to the member. Only supported for static methods. More...
 
- Properties inherited from Xunit.Sdk.DataAttribute
virtual string Skip [get, set]
 Marks all test cases generated by this data source as skipped. More...
 

Detailed Description

Provides a data source for a data theory, with the data coming from one of the following sources:

  1. A static property
  2. A static field
  3. 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.

Constructor & Destructor Documentation

◆ MemberDataAttribute()

Xunit.MemberDataAttribute.MemberDataAttribute ( string  memberName,
params object []  parameters 
)
inline

Initializes a new instance of the MemberDataAttribute class.

Parameters
memberNameThe name of the public static member on the test class that will provide the test data
parametersThe parameters for the member (only supported for methods; ignored for everything else)

The documentation for this class was generated from the following file: