public void Generate() { FirstName = DataGenerator.GetRandomFirstName(); LastName = DataGenerator.GetRandomLastName(); Email = string.Format("{0}.{1}@TestEmail.com", FirstName, LastName); SSN = DataGenerator.GetRandomSSN(); UsaCity city = UsaCities.GetRandomCity(); string zip = city.GetRandomZipCode(); Address.Zip = zip; Address.State = city.StateCode; Address.City = city.CityName; UsaState state = UsaStates.GetState(city.StateCode); CellPhone.AreaCode = UsaStates.GetRandomAreaCode(state); CellPhone.PhoneDetail1 = DataGenerator.GetRandomNumber3(); CellPhone.PhoneDetail2 = DataGenerator.GetRandomNumber4(); CellPhone.PhoneNumber = CellPhone.ToString(); if (city.AreaCodes.Length > 0) { CellPhone.AreaCode = city.GetRandomAreaCode(); CellPhone.PhoneNumber = CellPhone.ToString(); } LoginName = string.Format("{0}{1}", LastName, FirstName); }
static public string GetRandomAreaCode(UsaState state) { string areaCode = ""; string[] areaCodeList = state.AreaCodes.Split('-'); areaCode = areaCodeList[Random.Next(areaCodeList.Count())]; return(areaCode.Trim()); }
static public UsaState GetState(string StateCode) { UsaState state = null; foreach (UsaState item in stateList) { if (item.Abbrev.Equals(StateCode)) { return(item); } } return(state); }
public static string GetRandomAreaCode(UsaState state) { string areaCode = ""; string[] areaCodeList = state.AreaCodes.Split('-'); areaCode = areaCodeList[Random.Next(areaCodeList.Count())]; return areaCode.Trim(); }