diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 7c17e29192..798d66549e 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -12,12 +12,21 @@ namespace Content.IntegrationTests.Tests [TestFixture] public sealed class ClickableTest : ContentIntegrationTest { + private ClientIntegrationInstance _client; + private ServerIntegrationInstance _server; + private const double DirSouth = 0; private const double DirNorth = Math.PI; private const double DirEast = Math.PI / 2; private const double DirSouthEast = Math.PI / 4; private const double DirSouthEastJustShy = Math.PI / 4 - 0.1; + [OneTimeSetUp] + public async Task Setup() + { + (_client, _server) = await StartConnectedServerClientPair(); + } + [Parallelizable(ParallelScope.None)] [Test] [TestCase("ClickTestRotatingCornerVisible", 0.25f, 0.25f, DirSouth, 1, ExpectedResult = true)] @@ -48,11 +57,9 @@ namespace Content.IntegrationTests.Tests [TestCase("ClickTestRotatingCornerInvisibleNoRot", 0.25f, 0.25f, DirSouthEastJustShy, 1, ExpectedResult = true)] public async Task Test(string prototype, float clickPosX, float clickPosY, double angle, float scale) { - var (client, server) = await StartConnectedServerClientPair(); - EntityUid entity = default; - await server.WaitPost(() => + await _server.WaitPost(() => { var entMgr = IoCManager.Resolve(); var ent = entMgr.SpawnEntity(prototype, new MapCoordinates(0, 0, new MapId(1))); @@ -62,11 +69,11 @@ namespace Content.IntegrationTests.Tests }); // Let client sync up. - await RunTicksSync(client, server, 5); + await RunTicksSync(_client, _server, 5); var hit = false; - await client.WaitPost(() => + await _client.WaitPost(() => { var entMgr = IoCManager.Resolve(); var ent = entMgr.GetEntity(entity); @@ -75,6 +82,12 @@ namespace Content.IntegrationTests.Tests hit = clickable.CheckClick((clickPosX, clickPosY), out _, out _); }); + await _server.WaitPost(() => + { + var entMgr = IoCManager.Resolve(); + entMgr.DeleteEntity(entity); + }); + return hit; } }