Class Randomizer
Provides a set of methods for data randomization.
Inheritance
Inherited Members
Namespace: Relativity.Testing.Framework
Assembly: Relativity.Testing.Framework.dll
Syntax
public static class Randomizer
Fields
| Improve this Doc View SourceDefaultEmailAddressLength
The default random email address length.
Declaration
public const int DefaultEmailAddressLength = 35
Field Value
Type | Description |
---|---|
System.Int32 |
DefaultStringLength
The default random string length.
Declaration
public const int DefaultStringLength = 24
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceGetEmailAddress(Int32)
Gets the random email address.
Declaration
public static string GetEmailAddress(int length = 35)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
System.String | The random email address string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The length should be positive. Or the length of string is not greater than the format length. |
GetInt(Int32)
Returns a non-negative random integer that is less than the specified maximum.
Declaration
public static int GetInt(int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | max | The exclusive upper bound of the random number to be generated. Must be greater than or equal to |
Returns
Type | Description |
---|---|
System.Int32 | The random System.Int32 value. |
GetInt(Int32, Int32)
Returns a random integer that is within a specified range.
Declaration
public static int GetInt(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | min | The inclusive lower bound of the random number returned. |
System.Int32 | max | The inclusive upper bound of the random number returned. Must be greater than or equal to |
Returns
Type | Description |
---|---|
System.Int32 | The random System.Int32 value. |
GetPassword()
Gets a randomly generated password according to secure requirements.
Declaration
public static string GetPassword()
Returns
Type | Description |
---|---|
System.String | The random password. |
GetString(String, Int32)
Gets the random string.
Declaration
public static string GetString(string format = "{0}", int length = 24)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format, that can contain |
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
System.String | The random string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The length should be positive. Or the length of string is not greater than the format length. |