Class ValueSourceAttribute
Indicates the source used to provide data for one parameter of a test method.
Implements
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]
public class ValueSourceAttribute : NUnitAttribute, IParameterDataSource
Constructors
View SourceValueSourceAttribute(string?)
Construct with the name of the factory - for use with languages that don't support params arrays.
Declaration
public ValueSourceAttribute(string? sourceName)
Parameters
Type | Name | Description |
---|---|---|
string | sourceName | The name of a static method, property or field that will provide data. |
ValueSourceAttribute(Type?, string?)
Construct with a Type and name - for use with languages that don't support params arrays.
Declaration
public ValueSourceAttribute(Type? sourceType, string? sourceName)
Parameters
Type | Name | Description |
---|---|---|
Type | sourceType | The Type that will provide data |
string | sourceName | The name of a static method, property or field that will provide data. |
Properties
View SourceSourceName
The name of a the method, property or field to be used as a source
Declaration
public string? SourceName { get; }
Property Value
Type | Description |
---|---|
string |
SourceType
A Type to be used as a source
Declaration
public Type? SourceType { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
View SourceGetData(IParameterInfo)
Retrieves a list of arguments which can be passed to the specified parameter.
Declaration
public IEnumerable GetData(IParameterInfo parameter)
Parameters
Type | Name | Description |
---|---|---|
IParameterInfo | parameter | The parameter of a parameterized test. |
Returns
Type | Description |
---|---|
IEnumerable |