Files
RobustToolbox/Robust.Shared.IntegrationTests/GameObjects/EntitySystemManagerUninitializedTests.cs
2026-05-08 13:28:07 +02:00

26 lines
932 B
C#

using NUnit.Framework;
using Robust.Shared.GameObjects;
namespace Robust.Shared.IntegrationTests.GameObjects;
[TestFixture]
public sealed class EntitySystemManagerUninitializedTests
{
private sealed class DummySystem : EntitySystem;
[Test]
public void TryDoesNotThrow()
{
var systems = new EntitySystemManager();
// These should not throw even with an uninitalized entity system manager
Assert.DoesNotThrow(() => systems.TryGetEntitySystem(out DummySystem? _));
Assert.DoesNotThrow(() => systems.TryGetEntitySystem(typeof(DummySystem), out _));
Assert.DoesNotThrow(() => systems.GetEntitySystemOrNull<DummySystem>());
Assert.That(systems.TryGetEntitySystem(out DummySystem? _), Is.False);
Assert.That(systems.TryGetEntitySystem(typeof(DummySystem), out _), Is.False);
Assert.That(systems.GetEntitySystemOrNull<DummySystem>(), Is.Null);
}
}