Merge branch 'multiple-callbacks' into 20-11-13-merges

This commit is contained in:
Pieter-Jan Briers
2020-11-13 01:30:07 +01:00
3 changed files with 18 additions and 9 deletions

View File

@@ -82,9 +82,9 @@ namespace Content.Client
ClientContentIoC.Register();
if (TestingCallbacks != null)
foreach (var callback in TestingCallbacks)
{
var cast = (ClientModuleTestingCallbacks) TestingCallbacks;
var cast = (ClientModuleTestingCallbacks) callback;
cast.ClientBeforeIoC?.Invoke();
}

View File

@@ -55,6 +55,20 @@ namespace Content.IntegrationTests
options ??= new ServerIntegrationOptions();
options.ServerContentAssembly = typeof(Server.EntryPoint).Assembly;
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
options.BeforeStart += () =>
{
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
{
ServerBeforeIoC = () =>
{
if (options is ServerContentIntegrationOption contentOptions)
{
contentOptions.ContentBeforeIoC?.Invoke();
}
}
});
};
return base.StartServer(options);
}
@@ -67,11 +81,6 @@ namespace Content.IntegrationTests
{
ServerBeforeIoC = () =>
{
if (options is ServerContentIntegrationOption contentOptions)
{
contentOptions.ContentBeforeIoC?.Invoke();
}
IoCManager.Register<IGameTicker, DummyGameTicker>(true);
}
});

View File

@@ -44,9 +44,9 @@ namespace Content.Server
ServerContentIoC.Register();
if (TestingCallbacks != null)
foreach (var callback in TestingCallbacks)
{
var cast = (ServerModuleTestingCallbacks) TestingCallbacks;
var cast = (ServerModuleTestingCallbacks) callback;
cast.ServerBeforeIoC?.Invoke();
}