Class RandomAttribute
Supplies a set of random values to a single parameter of a parameterized test.
Implements
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public class RandomAttribute : NUnitAttribute, IParameterDataSource
Constructors
View SourceRandomAttribute(byte, byte, int)
Generates byte values within a specified range.
Declaration
public RandomAttribute(byte min, byte max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | min | |
| byte | max | |
| int | count |
RandomAttribute(double, double, int)
Generates double values within a specified range.
Declaration
public RandomAttribute(double min, double max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| double | min | |
| double | max | |
| int | count |
RandomAttribute(short, short, int)
Generates short values within a specified range.
Declaration
public RandomAttribute(short min, short max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| short | min | |
| short | max | |
| int | count |
RandomAttribute(int)
Construct a random set of values appropriate for the Type of the parameter on which the attribute appears, specifying only the count.
Declaration
public RandomAttribute(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count |
RandomAttribute(int, int, int)
Generates int values within a specified range.
Declaration
public RandomAttribute(int min, int max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | min | |
| int | max | |
| int | count |
RandomAttribute(long, long, int)
Generates long values within a specified range.
Declaration
public RandomAttribute(long min, long max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| long | min | |
| long | max | |
| int | count |
RandomAttribute(sbyte, sbyte, int)
Generates sbyte values within a specified range.
Declaration
[CLSCompliant(false)]
public RandomAttribute(sbyte min, sbyte max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte | min | |
| sbyte | max | |
| int | count |
RandomAttribute(float, float, int)
Generates float values within a specified range.
Declaration
public RandomAttribute(float min, float max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| float | min | |
| float | max | |
| int | count |
RandomAttribute(ushort, ushort, int)
Generates ushort values within a specified range.
Declaration
[CLSCompliant(false)]
public RandomAttribute(ushort min, ushort max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | min | |
| ushort | max | |
| int | count |
RandomAttribute(uint, uint, int)
Generates uint values within a specified range.
Declaration
[CLSCompliant(false)]
public RandomAttribute(uint min, uint max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | min | |
| uint | max | |
| int | count |
RandomAttribute(ulong, ulong, int)
Generates ulong values within a specified range.
Declaration
[CLSCompliant(false)]
public RandomAttribute(ulong min, ulong max, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | min | |
| ulong | max | |
| int | count |
Properties
View SourceDistinct
If true, no value will be repeated.
Declaration
public bool Distinct { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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 |