예제 #1
0
        /// <summary>
        /// Creates a random <see langword="IEnumerable"/> sequence of 0 to 20 objects of the specified type.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <param name="type">The type of objects to create.</param>
        /// <returns>A random <see langword="IEnumerable"/> sequence of the specified type of objects.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> or <paramref name="type"/> is <c>null</c>.</exception>
        public static IEnumerable AnyEnumerable(this IAnonymousData anon, Type type)
        {
            Argument.NotNull(anon, nameof(anon));
            Argument.NotNull(type, nameof(type));

            return(anon.AnyEnumerable(type, anon.GetMinimumItemCount(), anon.GetMaximumItemCount()));
        }
예제 #2
0
        /// <summary>
        /// Creates a random <see langword="IEnumerable{T}"/> sequence of 0 to 20 objects of the specified type.
        /// </summary>
        /// <typeparam name="T">The type of objects to create.</typeparam>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <returns>A random <see langword="IEnumerable{T}"/> sequence of the specified type of objects.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static IEnumerable <T> AnyEnumerable <T>(this IAnonymousData anon)
        {
            Argument.NotNull(anon, nameof(anon));

            return(anon.AnyEnumerable(typeof(T), anon.GetMinimumItemCount(), anon.GetMaximumItemCount()).Cast <T>());
        }