Integration tests improvements:
1. Added dummy game ticker for future tests to reduce startup time of test. (no loading a map) 2. Re-organized tests a bit.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
using Content.Client;
|
||||
using Content.Client.Interfaces.Parallax;
|
||||
using Content.Server;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.UnitTesting;
|
||||
using EntryPoint = Content.Client.EntryPoint;
|
||||
|
||||
namespace Content.IntegrationTests
|
||||
{
|
||||
@@ -11,7 +15,7 @@ namespace Content.IntegrationTests
|
||||
{
|
||||
protected override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
||||
{
|
||||
options = options ?? new ClientIntegrationOptions();
|
||||
options ??= new ClientIntegrationOptions();
|
||||
// ReSharper disable once RedundantNameQualifier
|
||||
options.ClientContentAssembly = typeof(EntryPoint).Assembly;
|
||||
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
||||
@@ -33,10 +37,27 @@ namespace Content.IntegrationTests
|
||||
|
||||
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
||||
{
|
||||
options = options ?? new ServerIntegrationOptions();
|
||||
options ??= new ServerIntegrationOptions();
|
||||
options.ServerContentAssembly = typeof(Server.EntryPoint).Assembly;
|
||||
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
||||
return base.StartServer(options);
|
||||
}
|
||||
|
||||
protected ServerIntegrationInstance StartServerDummyTicker(ServerIntegrationOptions options = null)
|
||||
{
|
||||
options ??= new ServerIntegrationOptions();
|
||||
options.BeforeStart += () =>
|
||||
{
|
||||
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
|
||||
{
|
||||
ServerBeforeIoC = () =>
|
||||
{
|
||||
IoCManager.Register<IGameTicker, DummyGameTicker>(true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return StartServer(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user