RobustUnitTest tweaks (#2568)

This commit is contained in:
metalgearsloth
2022-03-01 13:35:32 +11:00
committed by GitHub
parent 64ff046ceb
commit 4b20bae597
8 changed files with 54 additions and 72 deletions

View File

@@ -3,16 +3,19 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Server.Physics;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Containers;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Prototypes;
using Robust.Shared.Reflection;
using Robust.Shared.Utility;
using GridFixtureSystem = Robust.Client.GameObjects.GridFixtureSystem;
@@ -73,21 +76,22 @@ namespace Robust.UnitTesting
configurationManager.LoadCVarsFromAssembly(typeof(RobustUnitTest).Assembly);
// Required systems
var systems = IoCManager.Resolve<IEntitySystemManager>();
systems.Initialize();
// Required systems
systems.LoadExtraSystemType<ContainerSystem>();
systems.LoadExtraSystemType<TransformSystem>();
var entMan = IoCManager.Resolve<IEntityManager>();
if(entMan.EventBus == null)
{
entMan.Initialize();
entMan.Startup();
}
IoCManager.Resolve<IEntityLookup>().Startup();
var mapMan = IoCManager.Resolve<IMapManager>();
// So by default EntityManager does its own EntitySystemManager initialize during Startup.
// We want to bypass this and load our own systems hence we will manually initialize it here.
entMan.Initialize();
mapMan.Initialize();
systems.Initialize();
// TODO: Make this a system and it should be covered off by the above.
IoCManager.Resolve<IEntityLookup>().Startup();
IoCManager.Resolve<IReflectionManager>().LoadAssemblies(assemblies);
@@ -123,11 +127,7 @@ namespace Robust.UnitTesting
compFactory.RegisterClass<FixturesComponent>();
}
if(entMan.EventBus == null)
{
entMan.Startup();
}
entMan.Startup();
mapMan.Startup();
}