public async Task UpdatesAreAppliedToUser() { var testUser = new IdentityUser { UserName = "******", Email = "*****@*****.**", }; await _userStore.CreateAsync(testUser); var savedUser = await _userStore.FindByEmailAsync(testUser.Email); if (savedUser == null) { throw new NullReferenceException("savedUser"); } savedUser.EmailConfirmed = true; await _userStore.UpdateAsync(savedUser); savedUser = await _userStore.FindByEmailAsync(testUser.Email); Assert.IsNotNull(savedUser); Assert.IsTrue(savedUser.EmailConfirmed); }
public async Task CanCreateUser() { var testUser = new IdentityUser { UserName = "******", Email = "*****@*****.**", }; await _userStore.CreateAsync(testUser); var savedUser = await _userStore.FindByEmailAsync(testUser.Email); Assert.IsNotNull(savedUser); Assert.AreEqual(testUser.Email, savedUser.Email); }
public async Task UsersWithCustomIdsPersistThroughStorage() { var testUser = new IdentityUser { UserName = "******", Email = "*****@*****.**", Id = "*****@*****.**", }; await _userStore.CreateAsync(testUser); var savedUser = await _userStore.FindByEmailAsync(testUser.Email); Assert.IsNotNull(savedUser); Assert.AreEqual(testUser.Id, savedUser.Id); }
public async Task UsersWithNoSetIdDefaultToNewGuid() { var testUser = new IdentityUser { UserName = "******", Email = "*****@*****.**" }; await _userStore.CreateAsync(testUser); var savedUser = await _userStore.FindByEmailAsync(testUser.Email); Guid guidId; Assert.IsTrue(!string.IsNullOrEmpty(savedUser.Id)); Assert.IsTrue(Guid.TryParse(savedUser.Id, out guidId)); }
public async Task CanFindUserByLoginInfo() { var testUser = new IdentityUser { UserName = "******", Email = "*****@*****.**" }; await _userStore.CreateAsync(testUser); var user = await _userStore.FindByEmailAsync(testUser.Email); Assert.IsNotNull(user); var loginInfo = new UserLoginInfo("ATestLoginProvider", "ATestKey292929"); await _userStore.AddLoginAsync(user, loginInfo); var userByLoginInfo = await _userStore.FindAsync(loginInfo); Assert.IsNotNull(userByLoginInfo); }