diff --git a/Content.IntegrationTests/Tests/ResettingEntitySystemTests.cs b/Content.IntegrationTests/Tests/ResettingEntitySystemTests.cs new file mode 100644 index 0000000000..01dd1a4127 --- /dev/null +++ b/Content.IntegrationTests/Tests/ResettingEntitySystemTests.cs @@ -0,0 +1,58 @@ +using System.Threading.Tasks; +using Content.Server.GameTicking; +using Content.Server.Interfaces.GameTicking; +using Content.Shared.GameTicking; +using NUnit.Framework; +using Robust.Shared.GameObjects.Systems; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.IoC; + +namespace Content.IntegrationTests.Tests +{ + [TestFixture] + [TestOf(typeof(IResettingEntitySystem))] + public class ResettingEntitySystemTests : ContentIntegrationTest + { + private class TestResettingEntitySystem : EntitySystem, IResettingEntitySystem + { + public bool HasBeenReset { get; set; } + + public void Reset() + { + HasBeenReset = true; + } + } + + [Test] + public async Task ResettingEntitySystemResetTest() + { + var server = StartServer(new ServerContentIntegrationOption + { + ContentBeforeIoC = () => + { + IoCManager.Resolve().LoadExtraSystemType(); + } + }); + + await server.WaitIdleAsync(); + + var gameTicker = server.ResolveDependency(); + var entitySystemManager = server.ResolveDependency(); + + await server.WaitAssertion(() => + { + Assert.That(gameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound)); + + var system = entitySystemManager.GetEntitySystem(); + + system.HasBeenReset = false; + + Assert.False(system.HasBeenReset); + + gameTicker.RestartRound(); + + Assert.True(system.HasBeenReset); + }); + } + } +}