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

@@ -16,10 +16,51 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(HumanInventoryControllerComponent))]
public class HumanInventoryUniformSlotsTest : ContentIntegrationTest
{
private const string PROTOTYPES = @"
- type: entity
name: HumanDummy
id: HumanDummy
components:
- type: Inventory
- type: HumanInventoryController
- type: entity
name: UniformDummy
id: UniformDummy
components:
- type: Clothing
Slots: [innerclothing]
size: 5
- type: entity
name: IDCardDummy
id: IDCardDummy
components:
- type: Clothing
Slots:
- idcard
size: 5
- type: IdCard
- type: entity
name: FlashlightDummy
id: FlashlightDummy
components:
- type: Item
size: 5
- type: entity
name: ToolboxDummy
id: ToolboxDummy
components:
- type: Item
size: 9999
";
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
var server = StartServerDummyTicker(options);
IEntity human = null;
IEntity uniform = null;
@@ -35,11 +76,11 @@ namespace Content.IntegrationTests.Tests
var entityMan = IoCManager.Resolve<IEntityManager>();
human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
uniform = entityMan.SpawnEntity("UniformJanitor", MapCoordinates.Nullspace);
idCard = entityMan.SpawnEntity("AssistantIDCard", MapCoordinates.Nullspace);
pocketItem = entityMan.SpawnEntity("FlashlightLantern", MapCoordinates.Nullspace);
var tooBigItem = entityMan.SpawnEntity("ToolboxEmergency", MapCoordinates.Nullspace);
human = entityMan.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
uniform = entityMan.SpawnEntity("UniformDummy", MapCoordinates.Nullspace);
idCard = entityMan.SpawnEntity("IDCardDummy", MapCoordinates.Nullspace);
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace);
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace);
inventory = human.GetComponent<InventoryComponent>();