예제 #1
0
        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);
        }
예제 #2
0
 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));
 }
예제 #3
0
 public string GenerateStateName()
 {
     return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Animal));
 }
예제 #4
0
 public string GenerateFsmNetworkName()
 {
     return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Color));
 }
예제 #5
0
 public string GenerateFsmName()
 {
     return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Adjective));
 }
예제 #6
0
 public string GenerateFsmEnsembleName()
 {
     return(RandomNameGenerator.GenerateName(ThreadRandom, 5, 5) + " " + RandomNameGenerator.PickStringFromList(ThreadRandom, StringListEnum.Verb));
 }