private static async Task <string> EnsureUser(IServiceProvider serviceProvider, string testUserPw, string UserName, RandomNameGenerator generator) { var userManager = serviceProvider.GetService <UserManager <NEAUser> >(); var user = await userManager.FindByNameAsync(UserName); if (user == null) { var names = generator.GenerateName(); user = new NEAUser { FirstName = names[0], LastName = names[1], UserName = UserName, EmailConfirmed = true }; await userManager.CreateAsync(user, testUserPw); } if (user == null) { throw new Exception("The password is probably not strong enough!"); } return(user.Id); }
private void btnGenerateName_Click(object sender, EventArgs e) { lblGeneratedName.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(RandomNameGenerator.GenerateName(_threadRandom, 4, 5) + " the " + //RandomNameGenerator.PickStringFromList(_threadRandom, StringListEnum.Color) + "-colored " + RandomNameGenerator.PickStringFromList(_threadRandom, StringListEnum.Adjective) + " " + RandomNameGenerator.PickStringFromList(_threadRandom, StringListEnum.Verb) + " " + RandomNameGenerator.PickStringFromList(_threadRandom, StringListEnum.Animal)); }
public string GenerateStateName() { return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Animal)); }
public string GenerateFsmNetworkName() { return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Color)); }
public string GenerateFsmName() { return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Adjective)); }
public string GenerateFsmEnsembleName() { return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Verb)); }