Exemplo n.º 1
0
 public static byte Byte(byte minValue, byte maxValue)
 {
     return(Any.Value <byte>(
                new MinValueConstraint <byte>(minValue),
                new MaxValueConstraint <byte>(maxValue)
                ));
 }
Exemplo n.º 2
0
 public static ushort UShort(ushort minValue, ushort maxValue)
 {
     return(Any.Value <ushort>(
                new MinValueConstraint <ushort>(minValue),
                new MaxValueConstraint <ushort>(maxValue)
                ));
 }
Exemplo n.º 3
0
 public static ulong ULong(ulong minValue, ulong maxValue)
 {
     return(Any.Value <ulong>(
                new MinValueConstraint <ulong>(minValue),
                new MaxValueConstraint <ulong>(maxValue)
                ));
 }
Exemplo n.º 4
0
 public static uint UInt(uint minValue, uint maxValue)
 {
     return(Any.Value <uint>(
                new MinValueConstraint <uint>(minValue),
                new MaxValueConstraint <uint>(maxValue)
                ));
 }
Exemplo n.º 5
0
 public static double Double(double minValue, double maxValue)
 {
     return(Any.Value <double>(
                new MinValueConstraint <double>(minValue),
                new MaxValueConstraint <double>(maxValue)
                ));
 }
Exemplo n.º 6
0
 public static sbyte SByte(sbyte minValue, sbyte maxValue)
 {
     return(Any.Value <sbyte>(
                new MinValueConstraint <sbyte>(minValue),
                new MaxValueConstraint <sbyte>(maxValue)
                ));
 }
Exemplo n.º 7
0
 public static short Short(short minValue, short maxValue)
 {
     return(Any.Value <short>(
                new MinValueConstraint <short>(minValue),
                new MaxValueConstraint <short>(maxValue)
                ));
 }
Exemplo n.º 8
0
 public static long Long(long minValue, long maxValue)
 {
     return(Any.Value <long>(
                new MinValueConstraint <long>(minValue),
                new MaxValueConstraint <long>(maxValue)
                ));
 }
Exemplo 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)
                ));
 }
Exemplo n.º 10
0
 public static float Float(float minValue, float maxValue)
 {
     return(Any.Value <float>(
                new MinValueConstraint <float>(minValue),
                new MaxValueConstraint <float>(maxValue)
                ));
 }
Exemplo n.º 11
0
 public static decimal Decimal(decimal minValue, decimal maxValue)
 {
     return(Any.Value <decimal>(
                new MinValueConstraint <decimal>(minValue),
                new MaxValueConstraint <decimal>(maxValue)
                ));
 }
Exemplo 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));
            }
        }
Exemplo 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>());
 }
Exemplo n.º 14
0
 public static ulong ULong()
 {
     return(Any.Value <ulong>());
 }
Exemplo n.º 15
0
 public static byte Byte()
 {
     return(Any.Value <byte>());
 }
Exemplo n.º 16
0
 public static long Long()
 {
     return(Any.Value <long>());
 }
Exemplo n.º 17
0
 public static int Integer()
 {
     return(Any.Value <int>());
 }
Exemplo 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>());
 }
Exemplo n.º 19
0
 public static short Short()
 {
     return(Any.Value <sbyte>());
 }
Exemplo 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>());
 }
Exemplo n.º 21
0
 public static ushort UShort()
 {
     return(Any.Value <ushort>());
 }
Exemplo n.º 22
0
 public static string String()
 {
     return(Any.Value <string>());
 }
Exemplo n.º 23
0
 public static uint UInt()
 {
     return(Any.Value <uint>());
 }
Exemplo 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));
 }
Exemplo n.º 25
0
 public static sbyte SByte()
 {
     return(Any.Value <sbyte>());
 }