private static void GetTwoUsers(AccountUnitOfWork unit, [CallerMemberName] string caller = null) { var result = unit.RegisterUserAsync(new TelimenaUser(caller + "*****@*****.**", caller + "Jim Beam"), "P@ssword", TelimenaRoles.Developer).GetAwaiter() .GetResult(); if (!result.Item1.Succeeded) { var msg = result.Item1.Errors?.FirstOrDefault(); if (msg != null && !msg.Contains("is already taken.")) { Assert.Fail($"Failed to register user. Error: {result.Item1.Errors?.FirstOrDefault()}"); } } unit.Complete(); result = unit.RegisterUserAsync(new TelimenaUser(caller + "*****@*****.**", caller + "Jack Daniels"), "P@ssword", TelimenaRoles.Developer).GetAwaiter() .GetResult(); if (!result.Item1.Succeeded) { var msg = result.Item1.Errors?.FirstOrDefault(); if (msg != null && !msg.Contains("is already taken.")) { Assert.Fail($"Failed to register user. Error: {result.Item1.Errors?.FirstOrDefault()}"); } } unit.Complete(); }
private static void GetTwoUsers(AccountUnitOfWork unit, [CallerMemberName] string caller = null) { unit.RegisterUserAsync(new TelimenaUser(caller + "*****@*****.**", caller + "_Jim Beam"), "P@ssword", TelimenaRoles.Developer).GetAwaiter() .GetResult(); unit.Complete(); unit.RegisterUserAsync(new TelimenaUser(caller + "*****@*****.**", caller + "_Jack Daniels"), "P@ssword", TelimenaRoles.Developer).GetAwaiter() .GetResult(); unit.Complete(); }
public static async Task <TelimenaUser> CreateTelimenaUser(TelimenaPortalContext context, string email, string displayName = null, [CallerMemberName] string caller = "") { TelimenaUserManager manager = new TelimenaUserManager(new UserStore <TelimenaUser>(context)); AccountUnitOfWork unit = new AccountUnitOfWork(null, manager, context); TelimenaUser user = new TelimenaUser(caller + "_" + email, caller + "_" + (displayName ?? email.ToUpper())); await unit.RegisterUserAsync(user, "P@ssword", TelimenaRoles.Developer).ConfigureAwait(false); unit.Complete(); return(user); }
public static async Task <TelimenaUser> CreateTelimenaUser(TelimenaPortalContext context, string email, string displayName = null, [CallerMemberName] string caller = "") { TelimenaUserManager manager = new TelimenaUserManager(new UserStore <TelimenaUser>(context)); AccountUnitOfWork unit = new AccountUnitOfWork(null, manager, context); TelimenaUser user = new TelimenaUser(caller + "" + email, caller + "" + (displayName ?? email.ToUpper())); var result = await unit.RegisterUserAsync(user, "P@ssword", TelimenaRoles.Developer).ConfigureAwait(false); if (!result.Item1.Succeeded) { var msg = result.Item1.Errors?.FirstOrDefault(); if (msg != null && !msg.Contains("is already taken.")) { Assert.Fail($"Failed to register user {user.UserName}. Error: {result.Item1.Errors?.FirstOrDefault()}"); } } unit.Complete(); return(user); }