예제 #1
0
        public void GenerateWithSpecificMonikerStyleMethods(
            MonikerStyle monikerStyle,
            string separator,
            string expected)
        {
            string moniker;

            switch (monikerStyle)
            {
            case MonikerStyle.Moniker:
                moniker = separator == null
                        ? NameGenerator.GenerateMoniker()
                        : NameGenerator.GenerateMoniker(separator);

                break;

            case MonikerStyle.Moby:
                moniker = separator == null
                        ? NameGenerator.GenerateMoby()
                        : NameGenerator.GenerateMoby(separator);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(monikerStyle), monikerStyle, null);
            }

            moniker.Should().MatchRegex(expected);
        }
예제 #2
0
        public void GenerateWithMonikerStyleParameter(
            MonikerStyle monikerStyle,
            string separator,
            string expected)
        {
            var moniker = separator == null
                ? NameGenerator.Generate(monikerStyle)
                : NameGenerator.Generate(monikerStyle, separator);

            moniker.Should().MatchRegex(expected);
        }
예제 #3
0
        /// <summary>
        /// Generate a random name in the specified style.
        /// </summary>
        /// <param name="monikerStyle">The style of random name.</param>
        /// <param name="delimiter">An optional delimiter to use between adjective and noun.</param>
        /// <returns>The generated random name.</returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public static string Generate(MonikerStyle monikerStyle, string delimiter = DefaultDelimiter)
        {
            switch (monikerStyle)
            {
            case MonikerStyle.Moby:
                return(GenerateMoby(delimiter));

            case MonikerStyle.Moniker:
                return(GenerateMoniker(delimiter));

            default:
                throw new ArgumentOutOfRangeException(nameof(monikerStyle));
            }
        }