Legacy Documentation. View NUnit 3 Documentation

DatapointAttribute / DatapointsAttribute (NUnit 2.5) (Experimental)

The Datapoint and Datapoints attributes are used to provide data for Theories and are ignored for ordinary tests - including tests with parameters.

When a Theory is loaded, NUnit creates arguments for each of its parameters by using any fields of the same type as the parameter annotated with the DatapointAttribute. In addition, elements of arrays of the required type annotated with the DatapointsAttribute are also used.

Note: In the current release, these attributes are only recognized when used exactly as specified above. In particular, they may not be used on methods or properties and the DatapointsAttribute may only be placed on an array. These limitations will be removed in a later release.

For an example of use, see TheoryAttribute.

See also...