Make tests faster (#8737)

* Test changes

* Make finding the test tile a little smarter
This commit is contained in:
wrexbe
2022-06-19 20:22:28 -07:00
committed by GitHub
parent bd54b8de25
commit 81e3b2da88
80 changed files with 1769 additions and 1788 deletions

View File

@@ -12,7 +12,7 @@ namespace Content.IntegrationTests.Tests.Utility
{
[TestFixture]
[TestOf(typeof(EntitySystemExtensions))]
public sealed class EntitySystemExtensionsTest : ContentIntegrationTest
public sealed class EntitySystemExtensionsTest
{
private const string BlockerDummyId = "BlockerDummy";
@@ -34,10 +34,8 @@ namespace Content.IntegrationTests.Tests.Utility
[Test]
public async Task Test()
{
var serverOptions = new ServerContentIntegrationOption {ExtraPrototypes = Prototypes};
var server = StartServer(serverOptions);
await server.WaitIdleAsync();
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
var server = pairTracker.Pair.Server;
var sMapManager = server.ResolveDependency<IMapManager>();
var sEntityManager = server.ResolveDependency<IEntityManager>();
@@ -45,17 +43,17 @@ namespace Content.IntegrationTests.Tests.Utility
await server.WaitAssertion(() =>
{
var grid = GetMainGrid(sMapManager);
var grid = PoolManager.GetMainGrid(sMapManager);
var gridEnt = grid.GridEntityId;
var gridPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt).WorldPosition;
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
var entityCoordinates = PoolManager.GetMainEntityCoordinates(sMapManager);
// Nothing blocking it, only entity is the grid
Assert.NotNull(sEntityManager.SpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable));
Assert.True(sEntityManager.TrySpawnIfUnobstructed(null, entityCoordinates, CollisionGroup.Impassable, out var entity));
Assert.NotNull(entity);
var mapId = GetMainMapId(sMapManager);
var mapId = PoolManager.GetMainGrid(sMapManager).ParentMapId;
var mapCoordinates = new MapCoordinates(gridPos.X, gridPos.Y, mapId);
// Nothing blocking it, only entity is the grid
@@ -85,6 +83,7 @@ namespace Content.IntegrationTests.Tests.Utility
Assert.True(sEntityManager.TrySpawnIfUnobstructed(null, mapCoordinates, CollisionGroup.MidImpassable, out entity));
Assert.NotNull(entity);
});
await pairTracker.CleanReturnAsync();
}
}
}