xUnit.net
|
This class is responsible for discovering the data available in an implementation of DataAttribute. The discovery process may not always have access to reflection (i.e., running in Resharper), so the discoverer must make a best effort to return data, but may return null when there is not enough information available (for example, if reflection is required to answer the question). More...
Public Member Functions | |
IEnumerable< object[]> | GetData (IAttributeInfo dataAttribute, IMethodInfo testMethod) |
Returns the data to be used to test the theory. More... | |
bool | SupportsDiscoveryEnumeration (IAttributeInfo dataAttribute, IMethodInfo testMethod) |
Returns true if the data attribute supports enumeration during discovery; false otherwise. Data attributes with expensive computational costs and/or randomized data sets should return false . More... | |
This class is responsible for discovering the data available in an implementation of DataAttribute. The discovery process may not always have access to reflection (i.e., running in Resharper), so the discoverer must make a best effort to return data, but may return null when there is not enough information available (for example, if reflection is required to answer the question).
IEnumerable<object[]> Xunit.Sdk.IDataDiscoverer.GetData | ( | IAttributeInfo | dataAttribute, |
IMethodInfo | testMethod | ||
) |
Returns the data to be used to test the theory.
This will be called during discovery, at which point the testMethod may or may not be backed by reflection (i.e., implementing IReflectionMethodInfo). If the data is not available because reflection is required, then you may return null to inform xUnit that the quantity of data is unknown at this point. When the tests are run, if you returned back null during discovery, then this method will be called again to retrieve the data, this time guaranteed to provide an implementation of IReflectionMethodInfo. At this time, you must return the actual data, and returning null is not legal.
dataAttribute | The data attribute being discovered |
testMethod | The method that is being tested/discovered |
Implemented in Xunit.Sdk.DataDiscoverer, and Xunit.Sdk.InlineDataDiscoverer.
bool Xunit.Sdk.IDataDiscoverer.SupportsDiscoveryEnumeration | ( | IAttributeInfo | dataAttribute, |
IMethodInfo | testMethod | ||
) |
Returns true
if the data attribute supports enumeration during discovery; false
otherwise. Data attributes with expensive computational costs and/or randomized data sets should return false
.
Implemented in Xunit.Sdk.DataDiscoverer, Xunit.Sdk.InlineDataDiscoverer, and Xunit.Sdk.MemberDataDiscoverer.