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

@@ -59,10 +59,46 @@ namespace Content.IntegrationTests.Tests.Disposal
Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0));
}
private const string PROTOTYPES = @"
- type: entity
name: HumanDummy
id: HumanDummy
components:
- type: Damageable
damagePrototype: biologicalDamageContainer
criticalThreshold: 100
deadThreshold: 200
- type: entity
name: WrenchDummy
id: WrenchDummy
components:
- type: Tool
qualities:
- Anchoring
- type: entity
name: DisposalUnitDummy
id: DisposalUnitDummy
components:
- type: DisposalUnit
- type: Anchorable
- type: PowerReceiver
- type: Physics
anchored: true
- type: entity
name: DisposalTrunkDummy
id: DisposalTrunkDummy
components:
- type: DisposalEntry
";
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
var server = StartServerDummyTicker(options);
IEntity human;
IEntity wrench;
@@ -78,10 +114,10 @@ namespace Content.IntegrationTests.Tests.Disposal
var entityManager = IoCManager.Resolve<IEntityManager>();
// Spawn the entities
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
wrench = entityManager.SpawnEntity("Wrench", MapCoordinates.Nullspace);
var disposalUnit = entityManager.SpawnEntity("DisposalUnit", MapCoordinates.Nullspace);
var disposalTrunk = entityManager.SpawnEntity("DisposalTrunk", disposalUnit.Transform.MapPosition);
human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
wrench = entityManager.SpawnEntity("WrenchDummy", MapCoordinates.Nullspace);
var disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", MapCoordinates.Nullspace);
var disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
// Test for components existing
Assert.True(disposalUnit.TryGetComponent(out unit!));