예제 #1
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));
            }
        }