Exemple #1
0
        /// <summary>
        /// Constrains the generator so that it only produces sets with counts within the supplied range (inclusive).
        /// </summary>
        /// <param name="x">The first bound of the range.</param>
        /// <param name="y">The second bound of the range.</param>
        /// <returns>A new generator with the constraint applied.</returns>
        public static ISetGen <T> WithCountBetween <T>(this ISetGen <T> gen, int x, int y)
        {
            var minCount = x > y ? y : x;
            var maxCount = x > y ? x : y;

            return(gen.WithCountGreaterThanEqual(minCount).WithCountLessThanEqual(maxCount));
        }
Exemple #2
0
 /// <summary>
 /// Constrains the generator so that it only produces sets with greater than the given count.
 /// </summary>
 /// <param name="exclusiveMinCount">The minimum count that generated sets should be constrained to.</param>
 /// <returns>A new generator with the constraint applied.</returns>
 public static ISetGen <T> WithCountGreaterThan <T>(this ISetGen <T> gen, int exclusiveMinCount) =>
 gen.WithCountGreaterThanEqual(exclusiveMinCount + 1);