xUnit.net
Public Member Functions | Protected Member Functions | Properties | List of all members
Xunit.MemberDataAttributeBase Class Referenceabstract

Provides a base class for attributes that will provide member data. The member data must return something compatible with IEnumerable. Caution: the property is completely enumerated by .ToList() before any test is run. Hence it should return independent object sets. More...

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

Public Member Functions

override IEnumerable< object[]> GetData (MethodInfo testMethod)
 Returns the data to be used to test the theory.
 

Protected Member Functions

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

Properties

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 base class for attributes that will provide member data. The member data must return something compatible with IEnumerable. Caution: the property is completely enumerated by .ToList() before any test is run. Hence it should return independent object sets.

Constructor & Destructor Documentation

◆ MemberDataAttributeBase()

Xunit.MemberDataAttributeBase.MemberDataAttributeBase ( string  memberName,
object []  parameters 
)
inlineprotected

Initializes a new instance of the MemberDataAttributeBase 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)

Member Function Documentation

◆ ConvertDataItem()

abstract object [] Xunit.MemberDataAttributeBase.ConvertDataItem ( MethodInfo  testMethod,
object  item 
)
protectedpure virtual

Converts an item yielded by the data member to an object array, for return from GetData.

Parameters
testMethodThe method that is being tested.
itemAn item yielded from the data member.
Returns
An T:object[] suitable for return from GetData.

Implemented in Xunit.MemberDataAttribute.

Property Documentation

◆ DisableDiscoveryEnumeration

bool Xunit.MemberDataAttributeBase.DisableDiscoveryEnumeration
getset

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.

◆ MemberName

string Xunit.MemberDataAttributeBase.MemberName
get

Gets the member name.

◆ MemberType

Type Xunit.MemberDataAttributeBase.MemberType
getset

Gets or sets the type to retrieve the member from. If not set, then the property will be retrieved from the unit test class.

◆ Parameters

object [] Xunit.MemberDataAttributeBase.Parameters
get

Gets or sets the parameters passed to the member. Only supported for static methods.


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