Table of Contents

Class ValueSourceAttribute

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

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 string

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.

public ValueSourceAttribute(Type sourceType, string sourceName)

Parameters

sourceType Type

The Type that will provide data

sourceName string

The name of a static 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

string

SourceType

A Type to be used as a source

public Type SourceType { get; }

Property Value

Type

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 ParameterInfo

The parameter for which data is needed

Returns

IEnumerable

An enumeration containing individual data items