| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using qdr.fnd.core.test;
- using Quadarax.Application.QLiberace.Base.Repositories;
- using Quadarax.Application.QLiberace.Common.Domain;
- using Quadarax.Foundation.Core.Data.Interface.Repository;
- using Quadarax.Foundation.Core.Business;
- using Quadarax.Foundation.Core.Data.Domain;
- namespace Quadarax.Application.QLiberace.Base.Tests.Services.Base
- {
- public abstract class TenantBasedService<TService, TRepository> : ServiceDbContextTest<TService, TRepository, BaseInMemoryDbContext>
- where TService : AbstractRepositoryService<TRepository>
- where TRepository : IRepository
- {
- public const string TenantDefaultCode = "default";
- public const string TenantDefaultName = "Default system tenant";
- public const bool TenantDefaultIsLocked = false;
- public const string TenantOneCode = "one";
- public const string TenantOneName = "The one tenant";
- public const bool TenantOneIsLocked = false;
- protected QlbrcContext Context { get; private set; } = null!;
- protected override void OnSetup()
- {
- Context = new QlbrcContext(null, TenantDefaultCode, 1);
- base.OnSetup();
- var repoTenant = new RepoTenant(Uow.As<IDataDomain>(), Context);
- var tenant = repoTenant.New();
- tenant.Code = TenantDefaultCode;
- tenant.Name = TenantDefaultName;
- tenant.IsLocked = TenantDefaultIsLocked;
- tenant = repoTenant.New();
- tenant.Code = TenantOneCode;
- tenant.Name = TenantOneName;
- tenant.IsLocked = TenantOneIsLocked;
- repoTenant.Set(tenant);
- Uow.Commit();
- }
- }
- }
|