public void GenerateMaleName_Correct() { Gender gender = Gender.Male; var builder = _nameGenerator.GenerateName(); Assert.IsNotNull(builder); string name = _nameGenerator.AdjustToGender(builder, gender); Assert.IsNotNull(name); Assert.IsTrue(name.Length >= 2); Assert.IsTrue(name.Length <= 10); Assert.AreNotEqual('a', name.Last()); }
public CommandResult Execute() { var playerCount = playerRepository.GetPlayerCount(); var player = new Player { Id = idGenerator.GenerateId(new int[] { }), Name = nameGenerator.GenerateName(new string[] { }), X = random.Next(mapSettings.MapWidth), Y = random.Next(mapSettings.MapHeight), IsIt = playerCount == 0 }; playerRepository.Save(player); return(new CommandResult { Name = player.Name, Id = player.Id, IsIt = player.IsIt, MapWidth = mapSettings.MapWidth, MapHeight = mapSettings.MapHeight, X = player.X, Y = player.Y, Players = new List <PlayerResult>() }); }
Holding GenerateHolding(INameGenerator generator, string provinceId) { Province province = provinces[provinceId]; Array holdingTypes = Enum.GetValues(typeof(HoldingType)); HoldingType holdingType = (HoldingType)holdingTypes.GetValue(random.Next(1, holdingTypes.Length)); string name = generator.GenerateName(); Holding holding = new Holding { Id = $"h_{name.Replace(" ", "_").ToLower()}", ProvinceId = province.Id, Name = name, Description = $"The {name} {holdingType.ToString().ToLower()}", // TODO: Better description Type = holdingType }; // TODO: Make sure this never happens and then remove this workaround while (holdings.Values.Any(h => h.Id == holding.Id)) { return(GenerateHolding(generator, province.Id)); } return(holding); }
private string GetUniqueDatasetSlug() { // We are pretty sure this is unique but ALWAYS CHECK string dsSlug; do { // NOTE: We could generate a more language friendly slug, like docker does for its running containers dsSlug = _nameGenerator.GenerateName().ToSlug(); } while (_context.Datasets.FirstOrDefault(item => item.Slug == dsSlug) != null); return(dsSlug); }
private Hero GenerateHeroS(Race race, Gender gender, GenerateNamePreference generateNamePreference) { try { var physicalAttributes = new PhysicalAttributes(race); var progression = new Progression(); var vitals = new Vitals(); var traits = new Traits(); var generatedName = nameGenerator.GenerateName(gender, generateNamePreference); var hero = new Hero(generatedName, race, physicalAttributes, vitals, progression, traits); return(hero); } catch (System.Exception ex) { throw ex; } }
public void NameSetter(Person person) { var builder = _nameGenerator.GenerateName(); person.Name = _nameGenerator.AdjustToGender(builder, person.PersonGender); }