public Player Generate(Gender?playerGender = null, Country[] countries = null, PlayerPosition playerPosition = null) { if (playerGender == null) { playerGender = _genderGenerator.Generate(); } if (countries == null) { countries = _countriesGenerator.Generate().Value; } PersonName playerName = _nameGenerator.Generate(playerGender.Value, countries.FirstOrDefault()); Date dob = _dobGenerator.Generate(); PersonAge playerAge = PersonAge.FromDate(dob, _game.CurrentDate); Location birthLocation = _birthLocationGenerator.Generate(countries.FirstOrDefault()); Foot playerFoot = _favouriteFootGenerator.Generate(); Percentile percentile = _percentileGenerator.Generate(); BodyMassIndex bmi = _bmiGenerator.Generate(countries.FirstOrDefault(), playerGender.Value, percentile, dob); PlayerPosition position = _playerPositionGenerator.Generate(); PhysicalFeatureSet playerFeatureSet = _physicalFeatureSetGenerator.Generate(position, bmi, countries.FirstOrDefault(), playerAge); // first name & last name => according to the player's country return(new PlayerBuilder() .WithName(playerName) .WithGender(playerGender.Value) .WithBirthInfo(new BirthInfo(dob, birthLocation)) .WithFoot(playerFoot) .WithPercentile(percentile) .WithBodyMassIndex(bmi) .WithPlayerPosition(position) .WithFeatureSet(playerFeatureSet) .WithCountries(countries) .Build()); }
public IActionResult GenerateName() { var name = _nameGenerator.Generate(Players.Persons.Gender.Male, Country.France); return(Ok(name)); }