public Location Generate(Country country) { List <WorldCityRecord> cities = _worldCitiesLoader.GetRecords().Value; WorldCityRecord city = _listRandomiser.GetRandomisedItem(cities, record => record.CountryCodeIso2 == country.RegionInfo.TwoLetterISORegionName); return(new Location(new City(city.City), country)); }
public Lastname Generate(Gender gender, Country country) { List <LastnameRecord> lastnameRecords = _lastnameRecordsLoader.GetRecords(country); if (lastnameRecords == null) { throw new ApplicationException("Cannot find any lastname record."); } var lastname = _listRandomiser.GetRandomisedItem(lastnameRecords) .Lastname; return(new Lastname(lastname)); }
public Firstname Generate(Gender gender, Country country) { List <string> languages = country.Languages .Select(l => l.Value.ToLower()) .ToList(); List <FirstnameRecord> firstnamesRecords = _firstnameRecordsLoader.GetRecords().Value .Where(r => r.Genders.Contains(gender) && r.Frequency > 0d && languages.Any(l => r.Languages.Contains(l))) .ToList(); if (firstnamesRecords == null) { throw new ApplicationException("Cannot find any firstname record."); } FirstnameRecord record = _listRandomiser.GetRandomisedItem(firstnamesRecords); return(new Firstname(record.Firstname)); }
public PercentileGrowth GeneratePercentileGrowth(Gender gender) { AbstractPercentileGrowthSet growthSet = _percentileGrowthSetRepository.GetPercentileGrowthSet(gender); if (growthSet == null) { return(null); } List <PercentileGrowth> items = growthSet.Growths.ToList(); return(_listRandomiser.GetRandomisedItem(items)); }