public async Task CreateAsync_ExistingEmail_ReturnsFailure() { const string NewEmail = "*****@*****.**"; using var c = new UserManagerContext(_roles, _output); var user = new OntraportIdentityUser() { UserName = NewEmail, Email = NewEmail }; var result = await c.UserManager.CreateAsync(user, Password); Assert.False(result.Succeeded); }
public async Task DeleteAsync_InvalidId_ThrowsException() { const string NewEmail = "*****@*****.**"; using var c = new UserManagerContext(_roles, _output); var user = new OntraportIdentityUser() { Id = int.MaxValue, UserName = NewEmail, Email = NewEmail }; Task <IdentityResult> Act() => c.UserManager.DeleteAsync(user); await Assert.ThrowsAsync <HttpRequestException>(Act); }
public async Task CreateAsync_NewEmail_IdReturned() { const string NewEmail = "*****@*****.**"; using var c = new UserManagerContext(_roles, _output); var exist = await c.UserManager.FindByNameAsync(NewEmail); if (exist != null) { await c.UserManager.DeleteAsync(exist); } var user = new OntraportIdentityUser() { UserName = NewEmail, Email = NewEmail }; var result = await c.UserManager.CreateAsync(user, Password); Assert.True(result.Succeeded); Assert.True(user.Id > 0); }