ExamWebTestModule.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Abp.AspNetCore;
  2. using Abp.AspNetCore.TestBase;
  3. using Abp.Modules;
  4. using Abp.Reflection.Extensions;
  5. using YGNT.Exam.EntityFrameworkCore;
  6. using YGNT.Exam.Web.Startup;
  7. using Microsoft.AspNetCore.Mvc.ApplicationParts;
  8. namespace YGNT.Exam.Web.Tests
  9. {
  10. [DependsOn(
  11. typeof(ExamWebMvcModule),
  12. typeof(AbpAspNetCoreTestBaseModule)
  13. )]
  14. public class ExamWebTestModule : AbpModule
  15. {
  16. public ExamWebTestModule(ExamEntityFrameworkModule abpProjectNameEntityFrameworkModule)
  17. {
  18. abpProjectNameEntityFrameworkModule.SkipDbContextRegistration = true;
  19. }
  20. public override void PreInitialize()
  21. {
  22. Configuration.UnitOfWork.IsTransactional = false; //EF Core InMemory DB does not support transactions.
  23. }
  24. public override void Initialize()
  25. {
  26. IocManager.RegisterAssemblyByConvention(typeof(ExamWebTestModule).GetAssembly());
  27. }
  28. public override void PostInitialize()
  29. {
  30. IocManager.Resolve<ApplicationPartManager>()
  31. .AddApplicationPartsIfNotAddedBefore(typeof(ExamWebMvcModule).Assembly);
  32. }
  33. }
  34. }