Esempio n. 1
0
 public static byte Byte(byte minValue, byte maxValue)
 {
     return(Any.Value <byte>(
                new MinValueConstraint <byte>(minValue),
                new MaxValueConstraint <byte>(maxValue)
                ));
 }
Esempio n. 2
0
 public static ushort UShort(ushort minValue, ushort maxValue)
 {
     return(Any.Value <ushort>(
                new MinValueConstraint <ushort>(minValue),
                new MaxValueConstraint <ushort>(maxValue)
                ));
 }
Esempio n. 3
0
 public static ulong ULong(ulong minValue, ulong maxValue)
 {
     return(Any.Value <ulong>(
                new MinValueConstraint <ulong>(minValue),
                new MaxValueConstraint <ulong>(maxValue)
                ));
 }
Esempio n. 4
0
 public static uint UInt(uint minValue, uint maxValue)
 {
     return(Any.Value <uint>(
                new MinValueConstraint <uint>(minValue),
                new MaxValueConstraint <uint>(maxValue)
                ));
 }
Esempio n. 5
0
 public static double Double(double minValue, double maxValue)
 {
     return(Any.Value <double>(
                new MinValueConstraint <double>(minValue),
                new MaxValueConstraint <double>(maxValue)
                ));
 }
Esempio n. 6
0
 public static sbyte SByte(sbyte minValue, sbyte maxValue)
 {
     return(Any.Value <sbyte>(
                new MinValueConstraint <sbyte>(minValue),
                new MaxValueConstraint <sbyte>(maxValue)
                ));
 }
Esempio n. 7
0
 public static short Short(short minValue, short maxValue)
 {
     return(Any.Value <short>(
                new MinValueConstraint <short>(minValue),
                new MaxValueConstraint <short>(maxValue)
                ));
 }
Esempio n. 8
0
 public static long Long(long minValue, long maxValue)
 {
     return(Any.Value <long>(
                new MinValueConstraint <long>(minValue),
                new MaxValueConstraint <long>(maxValue)
                ));
 }
Esempio n. 9
0
 /// <summary>
 /// Returns an random integer value within a specified range.
 /// </summary>
 /// <param name="minValue">A minimal possible value.</param>
 /// <param name="maxValue">A maximal possible value.</param>
 /// <returns>An integer value within a specified range.</returns>
 public static int Integer(int minValue, int maxValue)
 {
     return(Any.Value <int>(
                new MinValueConstraint <int>(minValue),
                new MaxValueConstraint <int>(maxValue)
                ));
 }
Esempio n. 10
0
 public static float Float(float minValue, float maxValue)
 {
     return(Any.Value <float>(
                new MinValueConstraint <float>(minValue),
                new MaxValueConstraint <float>(maxValue)
                ));
 }
Esempio n. 11
0
 public static decimal Decimal(decimal minValue, decimal maxValue)
 {
     return(Any.Value <decimal>(
                new MinValueConstraint <decimal>(minValue),
                new MaxValueConstraint <decimal>(maxValue)
                ));
 }
Esempio n. 12
0
        /// <summary>
        /// Sets public properties of a given object to random values.
        /// </summary>
        /// <typeparam name="T">A type of object.</typeparam>
        /// <param name="instance">An object to generate values for.</param>
        public static void Properties <T>(T instance)
        {
            Require.NotNull(instance, "instance");

            var properties = instance.GetType().GetProperties().Where(p => p.CanWrite);

            foreach (var property in properties)
            {
                property.SetValue(instance, Any.Value(property.PropertyType));
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Returns a random float between 0.0 and 1.0.
 /// </summary>
 /// <returns>A random float between 0.0 and 1.0.</returns>
 public static float Float()
 {
     return(Any.Value <float>());
 }
Esempio n. 14
0
 public static ulong ULong()
 {
     return(Any.Value <ulong>());
 }
Esempio n. 15
0
 public static byte Byte()
 {
     return(Any.Value <byte>());
 }
Esempio n. 16
0
 public static long Long()
 {
     return(Any.Value <long>());
 }
Esempio n. 17
0
 public static int Integer()
 {
     return(Any.Value <int>());
 }
Esempio n. 18
0
 /// <summary>
 /// Returns a random double between 0.0 and 1.0.
 /// </summary>
 /// <returns>A random double between 0.0 and 1.0.</returns>
 public static double Double()
 {
     return(Any.Value <double>());
 }
Esempio n. 19
0
 public static short Short()
 {
     return(Any.Value <sbyte>());
 }
Esempio n. 20
0
 /// <summary>
 /// Returns a random decimal between 0.0 and 1.0.
 /// </summary>
 /// <returns>A random decimal between 0.0 and 1.0.</returns>
 public static decimal Decimal()
 {
     return(Any.Value <decimal>());
 }
Esempio n. 21
0
 public static ushort UShort()
 {
     return(Any.Value <ushort>());
 }
Esempio n. 22
0
 public static string String()
 {
     return(Any.Value <string>());
 }
Esempio n. 23
0
 public static uint UInt()
 {
     return(Any.Value <uint>());
 }
Esempio n. 24
0
 /// <summary>
 /// Returns a random value of a specified type using registered generators.
 /// </summary>
 /// <typeparam name="T">A type of value to generate.</typeparam>
 /// <param name="constraints">Optional constraints to be applied to a generated value.</param>
 /// <returns>A value of a specified type.</returns>
 public static T Value <T>(params IConstraint[] constraints)
 {
     return((T)Any.Value(typeof(T), constraints));
 }
Esempio n. 25
0
 public static sbyte SByte()
 {
     return(Any.Value <sbyte>());
 }