| 1234567891011121314151617181920212223242526272829 |
- using Quadarax.Foundation.Core.Data.Domain;
- using Quadarax.Foundation.Core.Data.Interface.Repository;
- namespace qdr.fnd.core.test
- {
- public abstract class RepositoryDbContextTest<TRepository, TDbContext> : BaseTest where TDbContext : DataDomain, new()
- where TRepository : IRepository
- {
- // ReSharper disable once InconsistentNaming
- protected DomainContextResolver<TDbContext>? _dbcResolver;
- protected UnitOfWork<TDbContext> Uow { get; private set; } = null!;
- protected override void OnSetup()
- {
- var context = new TDbContext();
- context.Database.EnsureCreated();
- _dbcResolver = new DomainContextResolver<TDbContext>(context);
- Uow = new UnitOfWork<TDbContext>(_dbcResolver);
- }
- protected override void OnTearDown()
- {
- _dbcResolver?.GetCurrent<TDbContext>().Dispose();
- _dbcResolver = null;
- }
- protected abstract TRepository GetRepository();
- }
- }
|