Class ValueSourceAttribute
ValueSourceAttribute indicates the source to be used to provide data for one parameter of a test method.
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]
public class ValueSourceAttribute : DataAttribute, IParameterDataSource
- Inheritance
-
ValueSourceAttribute
- Implements
- Inherited Members
Constructors
ValueSourceAttribute(string)
Construct with the name of the factory - for use with languages that don't support params arrays.
public ValueSourceAttribute(string sourceName)
Parameters
sourceName
stringThe name of the data source to be used
ValueSourceAttribute(Type, string)
Construct with a Type and name - for use with languages that don't support params arrays.
public ValueSourceAttribute(Type sourceType, string sourceName)
Parameters
sourceType
TypeThe Type that will provide data
sourceName
stringThe name of the method, property or field that will provide data
Properties
SourceName
The name of a the method, property or fiend to be used as a source
public string SourceName { get; }
Property Value
SourceType
A Type to be used as a source
public Type SourceType { get; }
Property Value
Methods
GetData(ParameterInfo)
Gets an enumeration of data items for use as arguments for a test method parameter.
public IEnumerable GetData(ParameterInfo parameter)
Parameters
parameter
ParameterInfoThe parameter for which data is needed
Returns
- IEnumerable
An enumeration containing individual data items