Skip to content

Commit b236b57

Browse files
committed
Allow test case to manually Initialize modules so that it can be fully constructed before virtual methods get called aspnetboilerplate#1060
1 parent 1ba4077 commit b236b57

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/TestBase/Abp.TestBase/TestBase/AbpIntegratedTestBase.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ public abstract class AbpIntegratedTestBase : IDisposable
2525

2626
private readonly AbpBootstrapper _bootstrapper;
2727

28-
protected AbpIntegratedTestBase()
28+
protected AbpIntegratedTestBase(bool manualInitialization = false)
2929
{
3030
LocalIocManager = new IocManager();
31+
_bootstrapper = new AbpBootstrapper(LocalIocManager);
32+
if (!manualInitialization)
33+
{
34+
Initialize();
35+
}
36+
}
3137

38+
protected void Initialize()
39+
{
3240
LocalIocManager.Register<IModuleFinder, TestModuleFinder>();
3341
LocalIocManager.Register<IAbpSession, TestAbpSession>();
3442

3543
AddModules(LocalIocManager.Resolve<TestModuleFinder>().Modules);
3644

3745
PreInitialize();
3846

39-
_bootstrapper = new AbpBootstrapper(LocalIocManager);
4047
_bootstrapper.Initialize();
4148

4249
AbpSession = LocalIocManager.Resolve<TestAbpSession>();

0 commit comments

Comments
 (0)