ImageServerWebTestModule.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 ImageServer.EntityFrameworkCore;
  6. using ImageServer.Web.Startup;
  7. using Microsoft.AspNetCore.Mvc.ApplicationParts;
  8. namespace ImageServer.Web.Tests
  9. {
  10. [DependsOn(
  11. typeof(ImageServerWebMvcModule),
  12. typeof(AbpAspNetCoreTestBaseModule)
  13. )]
  14. public class ImageServerWebTestModule : AbpModule
  15. {
  16. public ImageServerWebTestModule(ImageServerEntityFrameworkModule 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(ImageServerWebTestModule).GetAssembly());
  27. }
  28. public override void PostInitialize()
  29. {
  30. IocManager.Resolve<ApplicationPartManager>()
  31. .AddApplicationPartsIfNotAddedBefore(typeof(ImageServerWebMvcModule).Assembly);
  32. }
  33. }
  34. }