#nullable enable using System.Threading.Tasks; using Content.Server.Shuttles.Components; using NUnit.Framework; using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; namespace Content.IntegrationTests.Tests { [TestFixture] public sealed class ShuttleTest { [Test] public async Task Test() { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; var mapMan = server.ResolveDependency(); var sEntities = server.ResolveDependency(); EntityUid gridEnt = default; await server.WaitAssertion(() => { var mapId = mapMan.CreateMap(); var grid = mapMan.CreateGrid(mapId); gridEnt = grid.GridEntityId; Assert.That(sEntities.TryGetComponent(gridEnt, out ShuttleComponent? shuttleComponent)); Assert.That(sEntities.TryGetComponent(gridEnt, out PhysicsComponent? physicsComponent)); Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic)); Assert.That(sEntities.GetComponent(gridEnt).LocalPosition, Is.EqualTo(Vector2.Zero)); physicsComponent.ApplyLinearImpulse(Vector2.One); }); await server.WaitRunTicks(1); await server.WaitAssertion(() => { Assert.That(sEntities.GetComponent(gridEnt).LocalPosition, Is.Not.EqualTo(Vector2.Zero)); }); await pairTracker.CleanReturnAsync(); } } }