예제 #1
0
        /// <summary>
        /// Creates a random <see langword="string"/> value representing a first name.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <param name="male">If set to <c>true</c> a male first name is created; otherwise, a female
        /// first name is created.</param>
        /// <returns>A random first name.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static string AnyFirstName(this IAnonymousData anon, bool male)
        {
            Argument.NotNull(anon, nameof(anon));

            var names = male ? MaleFirstNames : FemaleFirstNames;

            return(anon.AnyItem(names));
        }
예제 #2
0
        /// <summary>
        /// Creates a random <see langword="string"/> value representing a full name.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <param name="male">If set to <c>true</c> a male full name is created; otherwise, a female
        /// full name is created.</param>
        /// <returns>A random full name.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static string AnyFullName(this IAnonymousData anon, bool male)
        {
            Argument.NotNull(anon, nameof(anon));

            var prefixes = male ? MalePrefixes : FemalPrefixes;

            switch (anon.AnyInt32(0, 10))
            {
            case 0:
                return($"{anon.AnyItem(prefixes)} {anon.AnySimpleFullName(male)}");

            case 1:
                return($"{anon.AnySimpleFullName(male)} {anon.AnyItem(Suffixes)}");

            case 2:
                return($"{anon.AnySimpleFullName(male)} {anon.AnyItem(GenerationalSuffixes)}");

            default:
                return(anon.AnySimpleFullName(male));
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a random <see langword="string"/> value representing a surname.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <returns>A random first name.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static string AnySurname(this IAnonymousData anon)
        {
            Argument.NotNull(anon, nameof(anon));

            return(anon.AnyItem(Surnames));
        }