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

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.IO;
using System.Threading.Tasks;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
@@ -8,6 +9,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.IntegrationTests.Tests
@@ -16,10 +18,19 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(InventoryHelpers))]
public class InventoryHelpersTest : ContentIntegrationTest
{
private const string PROTOTYPES = @"
- type: entity
name: InventoryStunnableDummy
id: InventoryStunnableDummy
components:
- type: Inventory
- type: Stunnable
";
[Test]
public async Task SpawnItemInSlotTest()
{
var server = StartServerDummyTicker();
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
var server = StartServerDummyTicker(options);
IEntity human = null;
InventoryComponent inventory = null;
@@ -34,7 +45,7 @@ namespace Content.IntegrationTests.Tests
var entityMan = IoCManager.Resolve<IEntityManager>();
human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
inventory = human.GetComponent<InventoryComponent>();
stun = human.GetComponent<StunnableComponent>();