Пример #1
0
        public IAccountData GetRandomFemale(CountryCode countryCode)
        {
            IAccountData accountData = new EmailAccountData {
                Sex = SexCode.Female
            };

            var sex = Enum.GetName(typeof(SexCode), accountData.Sex);

            accountData.BirthDate = GetBirthDate(random);
            accountData.Password  = CreatePassword(10);
            return(accountData);
        }
Пример #2
0
        public IAccountData GetRandom(CountryCode countryCode = CountryCode.EN)
        {
            IAccountData accountData = new EmailAccountData {
                Sex = SexCode.Male
            };

            if (random.NextDouble() > 0.5)
            {
                accountData.Sex = SexCode.Female;
            }
            var sex = Enum.GetName(typeof(SexCode), accountData.Sex);

            accountData.BirthDate = GetBirthDate(random);

            var lang = Enum.GetName(typeof(CountryCode), CountryCode.EN);

            if (countryCode == CountryCode.RU)
            {
                lang = Enum.GetName(typeof(CountryCode), CountryCode.RU);
            }

            var path = Path.Combine(_path, "Data");

            var filename      = Path.Combine(path, $"{nameof(IAccountData.Firstname)}{sex}{lang}.txt");
            var firstnameList = File.ReadAllLines(filename);

            accountData.Firstname = firstnameList[random.Next(firstnameList.Length)];

            filename = Path.Combine(path, $"{nameof(IAccountData.Lastname)}{sex}{lang}.txt");
            var lastnameList = File.ReadAllLines(filename);

            accountData.Lastname = lastnameList[random.Next(lastnameList.Length)];

            accountData.Password = CreatePassword(10);
            return(accountData);
        }