38 lines
1.2 KiB
C#

using Abp.AspNetCore;
using Abp.AspNetCore.TestBase;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using MineTec.ProManager.EntityFrameworkCore;
using MineTec.ProManager.Web.Startup;
namespace MineTec.ProManager.Web.Tests
{
[DependsOn(
typeof(ProManagerWebMvcModule),
typeof(AbpAspNetCoreTestBaseModule)
)]
public class ProManagerWebTestModule : AbpModule
{
public ProManagerWebTestModule(ProManagerEntityFrameworkModule abpProjectNameEntityFrameworkModule)
{
abpProjectNameEntityFrameworkModule.SkipDbContextRegistration = true;
}
public override void PreInitialize()
{
Configuration.UnitOfWork.IsTransactional = false; //EF Core InMemory DB does not support transactions.
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(ProManagerWebTestModule).GetAssembly());
}
public override void PostInitialize()
{
IocManager.Resolve<ApplicationPartManager>()
.AddApplicationPartsIfNotAddedBefore(typeof(ProManagerWebMvcModule).Assembly);
}
}
}