コード例 #1
0
        public string Generate()
        {
            IGenerator <string> fng = new FirstNameGenerator();
            IGenerator <string> lng = new LastNameGenerator();
            IGenerator <string> cng = new CompanyNameGenerator();

            string prefix  = GetPrefix(fng, lng);
            string bizname = GetBizname(cng);

            string[] suffix = new string[4] {
                ".com", ".net", ".org", ".info"
            };
            int    num        = random.Next(0, suffix.Length - 1);
            string domaintype = suffix[num];

            return(String.Format("{0}@{1}{2}", prefix, bizname, domaintype));
        }
コード例 #2
0
        public string Generate()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("http://www.");
            IGenerator <string> companyname = new CompanyNameGenerator();
            string bizname = (string)companyname.Generate();

            bizname = bizname.Replace(".", "");
            bizname = bizname.Replace(" ", "");
            bizname = bizname.Replace(",", "");
            sb.Append(bizname);
            string[] suffix = new string[4] {
                ".com", ".net", ".org", ".info"
            };
            int num = random.Next(0, suffix.Length - 1);

            sb.Append(suffix[num]);
            return(sb.ToString().ToLower());
        }