PgGenerators
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Creates the generators that PgPropertyRunner draws inputs from, like proptest’s built-in strategies.
public static class PgGeneratorsIntegers sometimes take their range’s limits so edge cases appear early, and they shrink toward zero, or toward the limit nearest zero when the range excludes it, preferring positive values. Text holds Unicode scalar values other than NUL, which PostgreSQL text cannot store, and favors ASCII letters and digits.
Inheritance: object
Methods
Section titled “Methods”Array<T>(PgGenerator<T>, int)
Section titled “Array<T>(PgGenerator<T>, int)”Produces arrays of generated elements.
public static PgGenerator<T[]> Array<T>(PgGenerator<T> element, int maxLength = 32)Type parameters:
T
The element type.
Parameters:
element — PgGenerator<T>
The element generator.
maxLength — int
The most elements.
Returns: PgGenerator<T[]>
The generator, which shrinks toward fewer and simpler elements.
Exceptions:
- ArgumentOutOfRangeException:
maxLengthis negative.
Boolean()
Section titled “Boolean()”Produces false or true, shrinking toward false.
public static PgGenerator<bool> Boolean()Returns: PgGenerator<bool>
The generator.
Constant<T>(T)
Section titled “Constant<T>(T)”Always produces the same value.
public static PgGenerator<T> Constant<T>(T value)Type parameters:
T
The value type.
Parameters:
value — T
The value.
Returns: PgGenerator<T>
The generator.
Element<T>(params T[])
Section titled “Element<T>(params T[])”Produces one of the supplied values, shrinking toward the first.
public static PgGenerator<T> Element<T>(params T[] values)Type parameters:
T
The value type.
Parameters:
values — T[]
The candidates.
Returns: PgGenerator<T>
The generator.
Exceptions:
- ArgumentException: No values are supplied.
FloatingPoint<T>()
Section titled “FloatingPoint<T>()”Produces any value of a binary floating-point type, such as double or float, including infinities, NaN, negative zero and subnormal values, shrinking toward small whole numbers.
public static PgGenerator<T> FloatingPoint<T>() where T : IBinaryFloatingPointIeee754<T>, IMinMaxValue<T>Type parameters:
T
Returns: PgGenerator<T>
The generator.
Exceptions:
- NotSupportedException:
Tis another floating-point type.
NullableReference<T>(PgGenerator<T>)
Section titled “NullableReference<T>(PgGenerator<T>)”Produces SQL NULL as null for one value in eight, otherwise a generated reference.
public static PgGenerator<T?> NullableReference<T>(PgGenerator<T> value) where T : classType parameters:
T
The reference type.
Parameters:
value — PgGenerator<T>
The value generator.
Returns: PgGenerator<T>
The generator.
Nullable<T>(PgGenerator<T>)
Section titled “Nullable<T>(PgGenerator<T>)”Produces SQL NULL as null for one value in eight, otherwise a generated value.
public static PgGenerator<T?> Nullable<T>(PgGenerator<T> value) where T : structType parameters:
T
The value type.
Parameters:
value — PgGenerator<T>
The value generator.
Returns: PgGenerator<T?>
The generator.
Number<T>()
Section titled “Number<T>()”Produces any value of an integer type, such as int, long or byte.
public static PgGenerator<T> Number<T>() where T : IBinaryInteger<T>, IMinMaxValue<T>Type parameters:
T
The integer type, at most 64 bits wide.
Returns: PgGenerator<T>
The generator.
Exceptions:
- NotSupportedException:
Tis wider than 64 bits.
Number<T>(T, T)
Section titled “Number<T>(T, T)”Produces integers in an inclusive range.
public static PgGenerator<T> Number<T>(T minimum, T maximum) where T : IBinaryInteger<T>Type parameters:
T
The integer type.
Parameters:
minimum — T
The smallest value.
maximum — T
The largest value.
Returns: PgGenerator<T>
The generator.
Exceptions:
- ArgumentOutOfRangeException:
maximumis less thanminimum. - NotSupportedException: The range holds more than 264 values.
OneOf<T>(params PgGenerator<T>[])
Section titled “OneOf<T>(params PgGenerator<T>[])”Produces a value from one of the supplied generators, shrinking toward the first.
public static PgGenerator<T> OneOf<T>(params PgGenerator<T>[] generators)Type parameters:
T
The value type.
Parameters:
generators — PgGenerator<T>[]
The alternatives.
Returns: PgGenerator<T>
The generator.
Exceptions:
- ArgumentException: No generators are supplied, or one is null.
Text(int)
Section titled “Text(int)”Produces text of Unicode scalar values other than NUL.
public static PgGenerator<string> Text(int maxLength = 32)Parameters:
maxLength — int
The most scalar values; text is at most twice as many UTF-16 characters.
Returns: PgGenerator<string>
The generator, which shrinks toward shorter text and simpler characters.
Exceptions:
- ArgumentOutOfRangeException:
maxLengthis negative.