Refactored integration tests to not use content entity prototypes (#2571)

* Refactored integration tests to not use content prototypes

* oops

* Apply suggestions from code review

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
DamianX
2020-11-18 15:30:36 +01:00
committed by GitHub
parent 501156f84c
commit 87e74c4494
17 changed files with 425 additions and 70 deletions

View File

@@ -13,10 +13,17 @@ namespace Content.IntegrationTests.Tests
[TestFixture]
public class GridTileLookupTest : ContentIntegrationTest
{
private const string PROTOTYPES = @"
- type: entity
name: Dummy
id: Dummy
";
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
var server = StartServerDummyTicker(options);
await server.WaitIdleAsync();
var entityManager = server.ResolveDependency<IEntityManager>();
@@ -39,12 +46,12 @@ namespace Content.IntegrationTests.Tests
Assert.That(entities.Count, Is.EqualTo(0));
// Space entity, check that nothing intersects it and that also it doesn't throw.
entityManager.SpawnEntity("HumanMob_Content", new MapCoordinates(Vector2.One * 1000, mapOne));
entityManager.SpawnEntity("Dummy", new MapCoordinates(Vector2.One * 1000, mapOne));
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(1000, 1000)).ToList();
Assert.That(entities.Count, Is.EqualTo(0));
var entityOne = entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
var entityOne = entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
var entityTiles = tileLookup.GetIndices(entityOne);
Assert.That(entityTiles.Count, Is.EqualTo(2));