<PackageReference Include="NUnit" Version="4.3.0" />

TestCaseSourceAttribute

Indicates the source to be used to provide test fixture instances for a test class. The name parameter is a String representing the name of the source used to provide test cases. It has the following characteristics:It must be a static field, property, or method in the same class as the test case.It must return an IEnumerable or a type that implements IEnumerable, such as an array, a List, or your own iterator.Each item returned by the enumerator must be compatible with the signature of the method on which the attribute appears.
public string Category { get; set; }

Gets or sets the category associated with every fixture created from this attribute. May be a single category or a comma-separated list.

public object[] MethodParams { get; }

A set of parameters passed to the method, works only if the Source Name is a method. If the source name is a field or property has no effect.

public string SourceName { get; }

The name of a the method, property or field to be used as a source

public Type SourceType { get; }

A Type to be used as a source

public TestCaseSourceAttribute(string sourceName)

Construct with the name of the method, property or field that will provide data

public TestCaseSourceAttribute(Type sourceType, string sourceName, object[] methodParams)

Construct with a Type and name

public TestCaseSourceAttribute(Type sourceType, string sourceName)

Construct with a Type and name

public TestCaseSourceAttribute(string sourceName, object[] methodParams)

Construct with a name

public TestCaseSourceAttribute(Type sourceType)

Construct with a Type

Builds any number of tests from the specified method and context.