using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Shouldly; using Volo.Abp.Identity; using Xunit; namespace Volo.Abp.Account { public class AccountAppService_Tests : AbpAccountApplicationTestBase { private readonly IAccountAppService _accountAppService; private readonly IIdentityUserRepository _identityUserRepository; private readonly ILookupNormalizer _lookupNormalizer; private readonly IdentityUserManager _userManager; public AccountAppService_Tests() { _accountAppService = GetRequiredService(); _identityUserRepository = GetRequiredService(); _lookupNormalizer = GetRequiredService(); _userManager = GetRequiredService(); } [Fact] public async Task RegisterAsync() { var registerDto = new RegisterDto { UserName = "bob.lee", EmailAddress = "bob.lee@abp.io", Password = "P@ssW0rd", AppName = "MVC" }; await _accountAppService.RegisterAsync(registerDto); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( _lookupNormalizer.NormalizeName("bob.lee")); user.ShouldNotBeNull(); user.UserName.ShouldBe("bob.lee"); user.Email.ShouldBe("bob.lee@abp.io"); (await _userManager.CheckPasswordAsync(user, "P@ssW0rd")).ShouldBeTrue(); } } }