Table of Contents

Class ValueSourceAttribute

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

Indicates the source used to provide data for one parameter of a test method.

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]
public class ValueSourceAttribute : NUnitAttribute, 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 field 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(IParameterInfo)

Retrieves a list of arguments which can be passed to the specified parameter.

public IEnumerable GetData(IParameterInfo parameter)

Parameters

parameter IParameterInfo

The parameter of a parameterized test.

Returns

IEnumerable