Randomizer
Randomizer returns a set of random values in a repeatable
way, to allow re-running of tests if necessary. It extends
the .NET Random class, providing random values for a much
wider range of types.
The class is used internally by the framework to generate
test case data and is also exposed for use by users through
the TestContext.Random property.
public const string DefaultStringChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789_"
Default characters for random functions.
Initial seed used to create randomizers for this run
public Randomizer()
Default constructor
Construct based on seed value
Create a new Randomizer using the next seed
available to ensure that each randomizer gives
a unique sequence of values.
Get a Randomizer for a particular member, returning
one that has already been created if it exists.
This ensures that the same values are generated
each time the tests are reloaded.
Get a randomizer for a particular parameter, returning
one that has already been created if it exists.
This ensures that the same values are generated
each time the tests are reloaded.
Generate a random string based on the characters from the input string.
Generate a random string based on the characters from the input string.
Generate a random string based on the characters from the input string.
Returns a random bool
Returns a random bool based on the probability a true result
Returns a random Byte
Returns a random Byte less than the specified maximum.
Returns a random Byte within a specified range
Returns a random decimal.
Returns a random decimal between positive zero and the specified maximum.
Returns a random decimal within a specified range, which is not
permitted to exceed decimal.MaxVal in the current implementation.
Returns a random double between 0.0 and the specified maximum.
Returns a random double within a specified range.
Returns a random enum value of the specified Type as an object.
Returns a random enum value of the specified Type.
Returns a random float.
Returns a random float between 0.0 and the specified maximum.
Returns a random float within a specified range.
Generates a valid version 4 Guid.
Returns a random long.
Returns a random long less than the specified maximum.
Returns a non-negative random long within a specified range.
Returns a random SByte
Returns a random sbyte less than the specified maximum.
Returns a random sbyte within a specified range
Returns a non-negative random short.
Returns a non-negative random short less than the specified maximum.
Returns a non-negative random short within a specified range.
Returns a random unsigned int.
Returns a random unsigned int less than the specified maximum.
Returns a random unsigned int within a specified range.
Returns a random ulong.
Returns a random ulong less than the specified maximum.
Returns a non-negative random long within a specified range.
Returns a random unsigned short.
Returns a random unsigned short less than the specified maximum.
Returns a random unsigned short within a specified range.