diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj index 9c831556a4..cb90a4af51 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj index 093113db66..08f3d324dd 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj index 1366f0d593..70b260335f 100644 --- a/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj +++ b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj index 8bed0f0aa9..62f8690af8 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj b/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj index 6c3ba1b676..8eac9e9162 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj @@ -16,9 +16,7 @@ - - diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Properties/launchSettings.json b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Properties/launchSettings.json new file mode 100644 index 0000000000..fc5b1a72f7 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53901/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.Identity.AspNetCore": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:53902/" + } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj index 12b84640c0..948dd4b7b3 100644 --- a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj @@ -1,20 +1,21 @@ - + - netstandard2.0 + netcoreapp3.0 Volo.Abp.Identity.AspNetCore Volo.Abp.Identity.AspNetCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false + true + Library - diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs index 5259047096..cf6e1f8d50 100644 --- a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs @@ -2,21 +2,24 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Identity; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.Uow; -namespace Volo.Abp.Identity +namespace Volo.Abp.Identity.AspNetCore { public class AbpSecurityStampValidator : SecurityStampValidator { public AbpSecurityStampValidator( IOptions options, SignInManager signInManager, - ISystemClock systemClock) + ISystemClock systemClock, + ILoggerFactory loggerFactory) : base( options, signInManager, - systemClock) + systemClock, + loggerFactory) { } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj index e86a7221de..6b58f2e433 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj @@ -15,15 +15,11 @@ - - - - diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj index 0919140b8c..b3ccc2e1b1 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj @@ -28,7 +28,7 @@ - + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaim.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaim.cs index 6b40b59ddb..d64218a68f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaim.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaim.cs @@ -20,11 +20,6 @@ namespace Volo.Abp.Identity /// public virtual string ClaimValue { get; protected set; } - public virtual bool Equals([NotNull] string claimType, [NotNull] string claimValue) - { - return ClaimType == claimType && ClaimValue == claimValue; - } - protected IdentityClaim() { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs index 20fb67dd06..70945c2546 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Identity //"admin" user const string adminUserName = "admin"; var adminUser = await _userRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.Normalize(adminUserName) + _lookupNormalizer.NormalizeName(adminUserName) ); if (adminUser != null) @@ -69,7 +69,7 @@ namespace Volo.Abp.Identity //"admin" role const string adminRoleName = "admin"; - var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize(adminRoleName)); + var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(adminRoleName)); if (adminRole == null) { adminRole = new IdentityRole( diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs index 684eec938f..bbbebb81cd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity { return ( await _userRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.Normalize(userName), + _lookupNormalizer.NormalizeName(userName), includeDetails: false, cancellationToken: cancellationToken ) diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj index 6b934006bc..945905d75f 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + netstandard2.1 Volo.Abp.Identity.EntityFrameworkCore Volo.Abp.Identity.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; @@ -15,7 +15,6 @@ - diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index 946db12050..5df9e6de60 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -48,6 +48,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { b.ToTable(options.TablePrefix + "UserClaims", options.Schema); + b.Property(x => x.Id).ValueGeneratedNever(); + b.Property(uc => uc.ClaimType).HasMaxLength(IdentityUserClaimConsts.MaxClaimTypeLength).IsRequired(); b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityUserClaimConsts.MaxClaimValueLength); @@ -112,6 +114,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { b.ToTable(options.TablePrefix + "RoleClaims", options.Schema); + b.Property(x => x.Id).ValueGeneratedNever(); + b.Property(uc => uc.ClaimType).HasMaxLength(IdentityRoleClaimConsts.MaxClaimTypeLength).IsRequired(); b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityRoleClaimConsts.MaxClaimValueLength); diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Properties/launchSettings.json b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Properties/launchSettings.json new file mode 100644 index 0000000000..6ba85345ab --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53978/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.Identity.HttpApi.Client": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:53980/" + } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj index b7e8a18755..a32fc8b2d0 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj @@ -1,15 +1,17 @@ - + - netstandard2.0 + netcoreapp3.0 Volo.Abp.Identity.HttpApi.Client Volo.Abp.Identity.HttpApi.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false + Library + true diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Properties/launchSettings.json b/modules/identity/src/Volo.Abp.Identity.HttpApi/Properties/launchSettings.json new file mode 100644 index 0000000000..2323768a18 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53977/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.Identity.HttpApi": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:53979/" + } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj index 01aba07d39..0ca4ef5564 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj @@ -1,21 +1,22 @@ - + - netstandard2.0 + netcoreapp3.0 Volo.Abp.Identity.HttpApi Volo.Abp.Identity.HttpApi $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false + Library + true - diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj index ae04586f3e..06e5717e03 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj @@ -1,4 +1,4 @@ - + @@ -15,7 +15,6 @@ - diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj index 8209c1c303..3561790e74 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj @@ -3,19 +3,21 @@ - netstandard2.0 + netcoreapp3.0 Volo.Abp.Identity.Web Volo.Abp.Identity.Web - true $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false Library + true - + + + diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj index e4f89cb750..6474dec386 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 Volo.Abp.Identity.Application.Tests Volo.Abp.Identity.Application.Tests true @@ -17,7 +17,7 @@ - + diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs index 7358238294..227977cf15 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByIdAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserLookupAppService.FindByIdAsync(user.Id)).UserName.ShouldBe(user.UserName); @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByUserNameAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserLookupAppService.FindByUserNameAsync(user.UserName)).UserName.ShouldBe(user.UserName); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj index 2e53b10544..9f94e6283e 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 Volo.Abp.Identity.Domain.Tests Volo.Abp.Identity.Domain.Tests true @@ -18,7 +18,7 @@ - + diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs index 221adca6d5..f8b42584ec 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io"); _testCounter.GetValue("EntityUpdatedEto").ShouldBe(0); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs index 9cdafa10bb..4314f3eac6 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); (await _identityRoleManager.SetRoleNameAsync(role, "teacher")).Succeeded.ShouldBeTrue(); @@ -48,12 +48,12 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); await _identityRoleManager.DeleteAsync(role); - (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator"))).ShouldBeNull(); + (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator"))).ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs index d2f674411b..11345a4a46 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); role.IsDefault = true; @@ -56,7 +56,7 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); await _identityRoleStore.DeleteAsync(role); @@ -67,7 +67,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRoleIdAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); (await _identityRoleStore.GetRoleIdAsync(role)).ShouldBe(_testData.RoleModeratorId.ToString()); @@ -76,7 +76,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); (await _identityRoleStore.GetRoleNameAsync(role)).ShouldBe(role.Name); @@ -86,7 +86,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); await _identityRoleStore.SetRoleNameAsync(role, "teacher"); @@ -106,7 +106,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -115,7 +115,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); (await _identityRoleStore.GetNormalizedRoleNameAsync(role)).ShouldBe(role.NormalizedName); @@ -124,12 +124,12 @@ namespace Volo.Abp.Identity [Fact] public async Task SetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.Normalize("teacher")); + await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.NormalizeName("teacher")); - role.NormalizedName.ShouldBe(_lookupNormalizer.Normalize("teacher")); + role.NormalizedName.ShouldBe(_lookupNormalizer.NormalizeName("teacher")); } [Fact] @@ -137,7 +137,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); var claims = await _identityRoleStore.GetClaimsAsync(role); @@ -149,30 +149,41 @@ namespace Volo.Abp.Identity } } - [Fact] public async Task AddClaimAsync() { - using (var uow = _unitOfWorkManager.Begin()) + try { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); - role.ShouldNotBeNull(); + using (var uow = _unitOfWorkManager.Begin()) + { + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + role.ShouldNotBeNull(); - await _identityRoleStore.AddClaimAsync(role, new Claim("my-claim", "my-value")); + role.Claims.Add(new IdentityRoleClaim(Guid.NewGuid(), role.Id, "my-claim", "my-value", role.TenantId)); + //await _identityRoleStore.AddClaimAsync(role, new Claim("my-claim", "my-value")); - role.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); + //role.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); - await uow.CompleteAsync(); + await uow.CompleteAsync(); + } + + } + catch (Exception e) + { + throw; } + + var role2 = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); + role2.ShouldNotBeNull(); + role2.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); } - [Fact] public async Task RemoveClaimAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("moderator")); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); await _identityRoleStore.RemoveClaimAsync(role, new Claim("test-claim", "test-value")); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs index 3755342375..761655deb2 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.Normalize("david")); + _lookupNormalizer.NormalizeName("david")); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() @@ -64,11 +64,11 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var roleSupporter = - await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("supporter")); + await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("supporter")); roleSupporter.ShouldNotBeNull(); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.Normalize("john.nash")); + _lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs index 0e4c1e8bc6..6e84a88450 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; using System.Security.Claims; -using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Shouldly; -using Volo.Abp.Guids; using Volo.Abp.Uow; using Xunit; @@ -31,7 +29,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUserIdAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetUserIdAsync(user)).ShouldBe(user.Id.ToString()); @@ -41,7 +39,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetUserNameAsync(user)).ShouldBe(user.UserName); @@ -50,7 +48,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetUserNameAsync(user, "bob.lee"); @@ -62,7 +60,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetNormalizedUserNameAsync(user)).ShouldBe(user.NormalizedUserName); @@ -71,12 +69,12 @@ namespace Volo.Abp.Identity [Fact] public async Task SetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.Normalize("bob.lee")); + await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.NormalizeName("bob.lee")); - user.NormalizedUserName.ShouldBe(_lookupNormalizer.Normalize("bob.lee")); + user.NormalizedUserName.ShouldBe(_lookupNormalizer.NormalizeName("bob.lee")); } [Fact] @@ -87,7 +85,7 @@ namespace Volo.Abp.Identity await _identityUserStore.CreateAsync(user); - var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("bob.lee")); + var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("bob.lee")); bobLee.ShouldNotBeNull(); bobLee.UserName.ShouldBe("bob.lee"); bobLee.Email.ShouldBe("bob.lee@abp.io"); @@ -96,20 +94,20 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Name = "lee"; (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash"))).Name + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).Name .ShouldBe("lee"); } [Fact] public async Task Update_Concurrency() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); @@ -128,12 +126,12 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.DeleteAsync(user)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash"))).ShouldBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).ShouldBeNull(); } @@ -150,7 +148,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -160,7 +158,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.PasswordHash.ShouldBeNull(); @@ -172,7 +170,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); @@ -183,7 +181,7 @@ namespace Volo.Abp.Identity [Fact] public async Task HasPasswordAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.HasPasswordAsync(user)).ShouldBeFalse(); @@ -191,17 +189,16 @@ namespace Volo.Abp.Identity (await _identityUserStore.HasPasswordAsync(user)).ShouldBeTrue(); } - [Fact] public async Task AddToRoleAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("david")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david")); user.ShouldNotBeNull(); user.Roles.ShouldBeEmpty(); - await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.Normalize("moderator")); + await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); @@ -209,17 +206,16 @@ namespace Volo.Abp.Identity } } - [Fact] public async Task RemoveFromRoleAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.Normalize("moderator")); + await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); user.Roles.ShouldNotContain(x => x.RoleId == _testData.RoleModeratorId); @@ -231,7 +227,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var roleNames = await _identityUserStore.GetRolesAsync(user); @@ -245,23 +241,22 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.Normalize("moderator"))).ShouldBeTrue(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.Normalize("moderatorNotExist"))).ShouldBeFalse(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderator"))).ShouldBeTrue(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderatorNotExist"))).ShouldBeFalse(); await uow.CompleteAsync(); } } - [Fact] public async Task GetClaimsAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var claims = await _identityUserStore.GetClaimsAsync(user); @@ -277,8 +272,9 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); + user.Claims.ShouldNotContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); await _identityUserStore.AddClaimsAsync(user, new List() { @@ -291,13 +287,12 @@ namespace Volo.Abp.Identity } } - [Fact] public async Task ReplaceClaimAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.ReplaceClaimAsync(user, new Claim("TestClaimType", "42"), new Claim("MyClaimType", "MyClaimValue")); @@ -308,14 +303,13 @@ namespace Volo.Abp.Identity await uow.CompleteAsync(); } } - - + [Fact] public async Task RemoveClaimsAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.RemoveClaimsAsync(user, new List() @@ -329,13 +323,12 @@ namespace Volo.Abp.Identity } } - [Fact] public async Task AddLoginAsync() { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Logins.ShouldNotContain(x => x.LoginProvider == "facebook" && x.ProviderKey == "john"); @@ -352,7 +345,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Logins.ShouldContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); @@ -370,7 +363,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var logins = await _identityUserStore.GetLoginsAsync(user); @@ -396,7 +389,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetEmailConfirmedAsync(user)).ShouldBe(user.EmailConfirmed); @@ -406,7 +399,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var emailConfirmed = user.EmailConfirmed; @@ -418,7 +411,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetEmailAsync(user, "john.nash.kobe@abp.io"); @@ -430,7 +423,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetEmailAsync(user)).ShouldBe(user.Email); @@ -439,7 +432,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetNormalizedEmailAsync(user)).ShouldBe(user.NormalizedEmail); @@ -448,18 +441,18 @@ namespace Volo.Abp.Identity [Fact] public async Task SetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.Normalize("john.nash.kobe@abp.io")); + await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); - user.NormalizedEmail.ShouldBe(_lookupNormalizer.Normalize("john.nash.kobe@abp.io")); + user.NormalizedEmail.ShouldBe(_lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); } [Fact] public async Task FindByEmailAsync() { - var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.Normalize("john.nash@abp.io")); + var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.NormalizeEmail("john.nash@abp.io")); user.ShouldNotBeNull(); user.Email.ShouldBe("john.nash@abp.io"); @@ -468,7 +461,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetLockoutEndDateAsync(user)).ShouldBe(user.LockoutEnd); @@ -477,7 +470,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetLockoutEndDateAsync(user, DateTimeOffset.Parse("01/01/2019")); @@ -489,7 +482,7 @@ namespace Volo.Abp.Identity [Fact] public async Task IncrementAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var count = user.AccessFailedCount; @@ -501,7 +494,7 @@ namespace Volo.Abp.Identity [Fact] public async Task ResetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.ResetAccessFailedCountAsync(user); @@ -512,7 +505,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetAccessFailedCountAsync(user)).ShouldBe(user.AccessFailedCount); @@ -521,7 +514,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetLockoutEnabledAsync(user)).ShouldBe(user.LockoutEnabled); @@ -530,7 +523,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var lockoutEnabled = user.LockoutEnabled; @@ -543,7 +536,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetPhoneNumberAsync(user, "13800138000"); @@ -555,7 +548,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetPhoneNumberAsync(user)).ShouldBe(user.PhoneNumber); @@ -564,7 +557,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetPhoneNumberConfirmedAsync(user)).ShouldBe(user.PhoneNumberConfirmed); @@ -574,7 +567,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var phoneNumberConfirmed = user.PhoneNumberConfirmed; @@ -587,7 +580,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var securityStamp = Guid.NewGuid().ToString(); @@ -599,7 +592,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetSecurityStampAsync(user)).ShouldBe(user.SecurityStamp); @@ -609,7 +602,7 @@ namespace Volo.Abp.Identity [Fact] public async Task SetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var twoFactorEnabled = user.TwoFactorEnabled; @@ -622,7 +615,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetTwoFactorEnabledAsync(user)).ShouldBe(user.TwoFactorEnabled); @@ -640,7 +633,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUsersInRoleAsync() { - var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.Normalize("moderator")); + var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.NormalizeName("moderator")); user.ShouldNotBeNull(); user.ShouldContain(x => x.UserName == "john.nash"); } @@ -650,7 +643,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetTokenAsync(user, "test-provider", "test-name", "123123"); @@ -667,7 +660,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.RemoveTokenAsync(user, "test-provider", "test-name"); @@ -683,7 +676,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); (await _identityUserStore.GetTokenAsync(user, "test-provider", "test-name")).ShouldBe("test-value"); @@ -697,7 +690,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); @@ -713,7 +706,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); @@ -729,7 +722,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); @@ -744,7 +737,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.ReplaceCodesAsync(user, new List() @@ -764,7 +757,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("john.nash")); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs index b5272ed0e7..0fc834ccc0 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs @@ -45,7 +45,7 @@ namespace Volo.Abp.Identity private void AddUserPermissions() { - var david = _userRepository.FindByNormalizedUserName(_lookupNormalizer.Normalize("david")); + var david = _userRepository.FindByNormalizedUserName(_lookupNormalizer.NormalizeName("david")); AddPermission(TestPermissionNames.MyPermission1, UserPermissionValueProvider.ProviderName, david.Id.ToString()); } diff --git a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj index c10e693a69..7aed694519 100644 --- a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 Volo.Abp.Identity.EntityFrameworkCore.Tests Volo.Abp.Identity.EntityFrameworkCore.Tests true @@ -20,10 +20,10 @@ - - - - + + + + diff --git a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj index ee3d4cfe5a..9648fd3500 100644 --- a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 Volo.Abp.Identity.MongoDB.Tests Volo.Abp.Identity.MongoDB.Tests true @@ -19,8 +19,8 @@ - - + + diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj index 6ab303021c..96eafd0ac1 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 Volo.Abp.Identity.TestBase Volo.Abp.Identity.TestBase true @@ -19,7 +19,7 @@ - + diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs index ee5fc56fd9..6df6fd8cb3 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity private void AddRoles() { - _adminRole = _roleRepository.FindByNormalizedName(_lookupNormalizer.Normalize("admin")); + _adminRole = _roleRepository.FindByNormalizedName(_lookupNormalizer.NormalizeName("admin")); _moderator = new IdentityRole(_testData.RoleModeratorId, "moderator"); _moderator.AddClaim(_guidGenerator, new Claim("test-claim", "test-value")); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs index a30cb6dd05..65eac5bc9d 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs @@ -27,9 +27,9 @@ namespace Volo.Abp.Identity { await _identityDataSeeder.SeedAsync("admin@abp.io", "1q2w3E*"); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("admin"))).ShouldNotBeNull(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize("admin"))).Name.ShouldBe("admin"); - (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.Normalize("admin"))).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).Name.ShouldBe("admin"); + (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs index c753c1958b..e4a15d15f1 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs @@ -23,8 +23,8 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedNameAsync() { - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.Normalize("admin"))).ShouldNotBeNull(); - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.Normalize("undefined-role"))).ShouldBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("undefined-role"))).ShouldBeNull(); } [Fact] @@ -45,7 +45,7 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Eager_Load_Role_Collections() { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.Normalize("moderator")); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs index 7ad01100e8..dca811da0b 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs @@ -25,22 +25,22 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedUserNameAsync() { - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("john.nash"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("undefined-user"))).ShouldBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("undefined-user"))).ShouldBeNull(); } [Fact] public async Task FindByNormalizedEmailAsync() { - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.Normalize("john.nash@abp.io"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.Normalize("david@abp.io"))).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.Normalize("undefined-user@abp.io"))).ShouldBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("john.nash@abp.io"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("david@abp.io"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("undefined-user@abp.io"))).ShouldBeNull(); } [Fact] public async Task GetRoleNamesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("john.nash")); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); var roles = await UserRepository.GetRoleNamesAsync(john.Id); roles.Count.ShouldBe(2); roles.ShouldContain("moderator"); @@ -80,7 +80,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetListByNormalizedRoleNameAsync() { - var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.Normalize("supporter")); + var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.NormalizeName("supporter")); users.Count.ShouldBe(2); users.ShouldContain(u => u.UserName == "john.nash"); users.ShouldContain(u => u.UserName == "neo"); @@ -114,7 +114,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("john.nash")); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); var roles = await UserRepository.GetRolesAsync(john.Id); roles.Count.ShouldBe(2); roles.ShouldContain(r => r.Name == "moderator"); @@ -131,7 +131,7 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Eager_Load_User_Collections() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("john.nash")); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs index 2a8f7c81a3..1ae671dd4f 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.Normalize("moderator"), includeDetails: false); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"), includeDetails: false); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.Normalize("john.nash"), includeDetails: false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"), includeDetails: false); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj b/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj index bec724072d..0dfe0c908e 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj index 5e7268131c..9c3d02a6fc 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj b/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj index a814f2ae47..2ba192fe5f 100644 --- a/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj +++ b/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj @@ -19,7 +19,7 @@ - +