Files
RobustToolbox/Robust.UnitTesting/RobustUnitTest.IoC.cs
PJB3005 788e9386fd Split up test project
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests.

Tests are now split into separate projects as appropriate, and the API side has also been split off.
2025-12-16 01:36:53 +01:00

43 lines
1.3 KiB
C#

using System;
using Robust.Client;
using Robust.Server;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
using Robust.Shared.Testing;
namespace Robust.UnitTesting
{
public partial class RobustUnitTest
{
/// <summary>
/// Registers all the types into the <see cref="IoCManager"/> with <see cref="IoCManager.Register{TInterface, TImplementation}"/>
/// </summary>
private void RegisterIoC()
{
var dependencies = IoCManager.Instance!;
switch (Project)
{
case UnitTestProject.Client:
ClientIoC.RegisterIoC(GameController.DisplayMode.Headless, dependencies);
break;
case UnitTestProject.Server:
ServerIoC.RegisterIoC(dependencies);
break;
default:
throw new NotSupportedException($"Unknown testing project: {Project}");
}
dependencies.Register<IModLoader, TestingModLoader>(overwrite: true);
dependencies.Register<IModLoaderInternal, TestingModLoader>(overwrite: true);
dependencies.Register<TestingModLoader, TestingModLoader>(overwrite: true);
OverrideIoC();
dependencies.BuildGraph();
}
}
}