Ejemplo n.º 1
0
        private static IEnumerable <IEnumerable <T> > ShrinkOne <T> (IEnumerable <T> e)
        {
            if (e.None())
            {
                return(new IEnumerable <T> [0]);
            }
            var first = e.First();
            var rest  = e.Skip(1);

            return((from x in Arbitrary.Get <T> ().Shrink(first)
                    select rest.Append(x)).Concat(
                       from xs in ShrinkOne(e.Skip(1))
                       select xs.Append(first)));
        }
Ejemplo n.º 2
0
 public static Property <T> Choose <T> ()
 {
     return(ForAll(Arbitrary.Get <T> ()));
 }
Ejemplo n.º 3
0
 /*
  * The other version of the ForAll method can be called without specifying
  * the IArbitrary instance. The method uses the default arbitrary
  * implementation that is registered for the given type.
  */
 public static Prop <T> ForAll <T> ()
 {
     return(ForAll(Arbitrary.Get <T> ()));
 }