From 2a1eda0d38dc578d29b56bdb98fd2cf6fa3b428f Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 12 May 2021 01:57:03 +0200 Subject: [PATCH] Fix tests --- Robust.UnitTesting/RobustUnitTest.cs | 3 +-- .../GameObjects/Components/Container_Test.cs | 2 +- .../ThrowingEntityDeletion_Test.cs | 8 ++++---- .../Server/Maps/MapLoaderTest.cs | 2 +- .../Server/RobustServerSimulation.cs | 19 +++++-------------- .../ComponentDependencies_Tests.cs | 18 +++++++++--------- .../GameObjects/ComponentFactory_Tests.cs | 2 +- .../Shared/Localization/LocalizationTests.cs | 2 +- .../Prototypes/PrototypeManager_Test.cs | 2 +- 9 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Robust.UnitTesting/RobustUnitTest.cs b/Robust.UnitTesting/RobustUnitTest.cs index cfe98565f6..c0c2fd14a9 100644 --- a/Robust.UnitTesting/RobustUnitTest.cs +++ b/Robust.UnitTesting/RobustUnitTest.cs @@ -88,8 +88,7 @@ namespace Robust.UnitTesting var compFactory = IoCManager.Resolve(); if (!compFactory.AllRegisteredTypes.Contains(typeof(MetaDataComponent))) { - compFactory.Register(); - compFactory.RegisterReference(); + compFactory.RegisterClass(); } if(entMan.EventBus == null) diff --git a/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs b/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs index e305657aea..3a9d27cf95 100644 --- a/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs +++ b/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs @@ -16,7 +16,7 @@ namespace Robust.UnitTesting.Server.GameObjects.Components { var sim = RobustServerSimulation .NewSimulation() - .RegisterComponents(factory => { factory.RegisterClass(); factory.RegisterReference(); }) + .RegisterComponents(factory => { factory.RegisterClass(); }) .RegisterPrototypes(protoMan => protoMan.LoadString(PROTOTYPES)) .InitializeInstance(); diff --git a/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs b/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs index 2d0b62727a..98d48f3c68 100644 --- a/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs +++ b/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs @@ -38,10 +38,10 @@ namespace Robust.UnitTesting.Server.GameObjects { _componentFactory = IoCManager.Resolve(); - _componentFactory.Register(); - _componentFactory.Register(); - _componentFactory.Register(); - + _componentFactory.RegisterClass(); + _componentFactory.RegisterClass(); + _componentFactory.RegisterClass(); + EntityManager = IoCManager.Resolve(); MapManager = IoCManager.Resolve(); diff --git a/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs b/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs index dbdedaf9b3..c0765e06a3 100644 --- a/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs +++ b/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs @@ -83,7 +83,7 @@ entities: public void Setup() { var compFactory = IoCManager.Resolve(); - compFactory.Register(); + compFactory.RegisterClass(); IoCManager.Resolve().Initialize(); var resourceManager = IoCManager.Resolve(); diff --git a/Robust.UnitTesting/Server/RobustServerSimulation.cs b/Robust.UnitTesting/Server/RobustServerSimulation.cs index f295f7af43..408198e93e 100644 --- a/Robust.UnitTesting/Server/RobustServerSimulation.cs +++ b/Robust.UnitTesting/Server/RobustServerSimulation.cs @@ -193,20 +193,11 @@ namespace Robust.UnitTesting.Server var compFactory = container.Resolve(); - compFactory.Register(); - compFactory.RegisterReference(); - - compFactory.Register(); - compFactory.RegisterReference(); - - compFactory.Register(); - compFactory.RegisterReference(); - - compFactory.Register(); - compFactory.RegisterReference(); - - compFactory.Register(); - compFactory.RegisterReference(); + compFactory.RegisterClass(); + compFactory.RegisterClass(); + compFactory.RegisterClass(); + compFactory.RegisterClass(); + compFactory.RegisterClass(); _regDelegate?.Invoke(compFactory); diff --git a/Robust.UnitTesting/Shared/GameObjects/ComponentDependencies_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/ComponentDependencies_Tests.cs index 1fb5bf69ea..927eaba545 100644 --- a/Robust.UnitTesting/Shared/GameObjects/ComponentDependencies_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/ComponentDependencies_Tests.cs @@ -114,6 +114,7 @@ namespace Robust.UnitTesting.Shared.GameObjects private interface ITestInterfaceUnreferenced : IComponent { } + [ComponentReference(typeof(ITestInterfaceInterface))] private class TestInterfaceComponent : Component, ITestInterfaceInterface, ITestInterfaceUnreferenced { public override string Name => "TestInterface"; @@ -155,15 +156,14 @@ namespace Robust.UnitTesting.Shared.GameObjects public void Setup() { var componentFactory = IoCManager.Resolve(); - componentFactory.Register(); - componentFactory.Register(); - componentFactory.Register(); - componentFactory.Register(); - componentFactory.RegisterReference(); - componentFactory.Register(); - componentFactory.Register(); - componentFactory.Register(); - componentFactory.Register(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); + componentFactory.RegisterClass(); IoCManager.Resolve().Initialize(); var prototypeManager = IoCManager.Resolve(); diff --git a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs index 441f7a49b2..ab5629a381 100644 --- a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs @@ -17,7 +17,7 @@ namespace Robust.UnitTesting.Shared.GameObjects [OneTimeSetUp] public void OneTimeSetUp() { - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } [Test] diff --git a/Robust.UnitTesting/Shared/Localization/LocalizationTests.cs b/Robust.UnitTesting/Shared/Localization/LocalizationTests.cs index 6dc827eae2..e8bcd97fd8 100644 --- a/Robust.UnitTesting/Shared/Localization/LocalizationTests.cs +++ b/Robust.UnitTesting/Shared/Localization/LocalizationTests.cs @@ -19,7 +19,7 @@ namespace Robust.UnitTesting.Shared.Localization public void Setup() { IoCManager.Resolve().Initialize(); - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); var res = IoCManager.Resolve(); res.MountString("/Locale/en-US/a.ftl", FluentCode); diff --git a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs index e28ff2ccfc..3c4ac98547 100644 --- a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs +++ b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs @@ -22,7 +22,7 @@ namespace Robust.UnitTesting.Shared.Prototypes public void Setup() { var factory = IoCManager.Resolve(); - factory.Register(); + factory.RegisterClass(); factory.RegisterClass(); IoCManager.Resolve().Initialize();