Browse Source

Address Copilot review feedback

pull/25319/head
maliming 5 months ago
parent
commit
5bb367e520
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 6
      modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs
  2. 12
      modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/AbpIdentitySharedUserSeparateDbMongoDbTestModule.cs
  3. 12
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentitySharedUserSeparateDbConstants.cs
  4. 4
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserManager_SharedUser_SeparateDatabase_Tests.cs

6
modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs

@ -25,10 +25,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore;
typeof(AbpEntityFrameworkCoreSqliteModule))]
public class AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule : AbpModule
{
public static readonly Guid TenantAId =
IdentityUserManager_SharedUser_SeparateDatabase_Tests<AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule>.TenantAId;
public static readonly Guid TenantBId =
IdentityUserManager_SharedUser_SeparateDatabase_Tests<AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule>.TenantBId;
public static readonly Guid TenantAId = IdentitySharedUserSeparateDbConstants.TenantAId;
public static readonly Guid TenantBId = IdentitySharedUserSeparateDbConstants.TenantBId;
// Per-app keep-alive connections so the in-memory SQLite databases survive for the test's
// lifetime (without an open connection, shared-cache in-memory databases are discarded).

12
modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/AbpIdentitySharedUserSeparateDbMongoDbTestModule.cs

@ -13,14 +13,16 @@ namespace Volo.Abp.Identity.MongoDB;
[DependsOn(typeof(AbpIdentityMongoDbTestModule))]
public class AbpIdentitySharedUserSeparateDbMongoDbTestModule : AbpModule
{
public static readonly Guid TenantAId = Guid.Parse("11111111-1111-1111-1111-111111111111");
public static readonly Guid TenantBId = Guid.Parse("22222222-2222-2222-2222-222222222222");
public static readonly Guid TenantAId = IdentitySharedUserSeparateDbConstants.TenantAId;
public static readonly Guid TenantBId = IdentitySharedUserSeparateDbConstants.TenantBId;
public override void ConfigureServices(ServiceConfigurationContext context)
{
// Fixed db names so MongoSandbox's embedded mongod does not accumulate one db per test
// method. Each test method generates unique email / userName so cross-test data does not
// collide on those fields.
// Fixed tenant db names so MongoSandbox's embedded mongod does not accumulate one tenant
// db per test method. The host/default database is still configured by
// AbpIdentityMongoDbTestModule (random per test run), since AbpIdentityTestBaseModule
// re-seeds the host admin/role on every AbpApplication initialization. Each test method
// generates unique email / userName so cross-test data does not collide.
var tenantAConnection = MongoDbFixture.GetConnectionString("AbpIdentity_SharedSeparateDb_TenantA");
var tenantBConnection = MongoDbFixture.GetConnectionString("AbpIdentity_SharedSeparateDb_TenantB");

12
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentitySharedUserSeparateDbConstants.cs

@ -0,0 +1,12 @@
using System;
namespace Volo.Abp.Identity;
// Single source of truth for the predefined tenant ids used by the shared-user separate-database
// test suite. Concrete EF/Mongo test modules and the abstract test class both reference these
// constants directly so the modules don't have to type-couple back into the test class.
public static class IdentitySharedUserSeparateDbConstants
{
public static readonly Guid TenantAId = Guid.Parse("11111111-1111-1111-1111-111111111111");
public static readonly Guid TenantBId = Guid.Parse("22222222-2222-2222-2222-222222222222");
}

4
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserManager_SharedUser_SeparateDatabase_Tests.cs

@ -22,8 +22,8 @@ namespace Volo.Abp.Identity;
public abstract class IdentityUserManager_SharedUser_SeparateDatabase_Tests<TStartupModule> : AbpIdentityTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
public static readonly Guid TenantAId = Guid.Parse("11111111-1111-1111-1111-111111111111");
public static readonly Guid TenantBId = Guid.Parse("22222222-2222-2222-2222-222222222222");
public static readonly Guid TenantAId = IdentitySharedUserSeparateDbConstants.TenantAId;
public static readonly Guid TenantBId = IdentitySharedUserSeparateDbConstants.TenantBId;
protected IdentityUserManager IdentityUserManager { get; }
protected IIdentityUserRepository IdentityUserRepository { get; }

Loading…
Cancel
Save