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

@@ -21,10 +21,30 @@ namespace Content.IntegrationTests.Tests.Buckle
[TestOf(typeof(StrapComponent))]
public class BuckleTest : ContentIntegrationTest
{
private const string PROTOTYPES = @"
- type: entity
name: BuckleDummy
id: BuckleDummy
components:
- type: Buckle
- type: Transform
- type: Hands
- type: Body
template: HumanoidTemplate
preset: HumanPreset
centerSlot: torso
- type: entity
name: StrapDummy
id: StrapDummy
components:
- type: Strap
";
[Test]
public async Task BuckleUnbuckleCooldownRangeTest()
{
var server = StartServerDummyTicker();
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
var server = StartServerDummyTicker(options);
IEntity human = null;
IEntity chair = null;
@@ -39,8 +59,8 @@ namespace Content.IntegrationTests.Tests.Buckle
var entityManager = IoCManager.Resolve<IEntityManager>();
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
chair = entityManager.SpawnEntity("ChairWood", MapCoordinates.Nullspace);
human = entityManager.SpawnEntity("BuckleDummy", MapCoordinates.Nullspace);
chair = entityManager.SpawnEntity("StrapDummy", MapCoordinates.Nullspace);
// Default state, unbuckled
Assert.True(human.TryGetComponent(out buckle));
@@ -173,7 +193,8 @@ namespace Content.IntegrationTests.Tests.Buckle
[Test]
public async Task BuckledDyingDropItemsTest()
{
var server = StartServer();
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
var server = StartServer(options);
IEntity human;
IEntity chair;
@@ -198,8 +219,8 @@ namespace Content.IntegrationTests.Tests.Buckle
grid.SetTile(coordinates, tile);
human = entityManager.SpawnEntity("HumanMob_Content", coordinates);
chair = entityManager.SpawnEntity("ChairWood", coordinates);
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
// Component sanity check
Assert.True(human.TryGetComponent(out buckle));
@@ -263,7 +284,8 @@ namespace Content.IntegrationTests.Tests.Buckle
[Test]
public async Task ForceUnbuckleBuckleTest()
{
var server = StartServer();
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
var server = StartServer(options);
IEntity human = null;
IEntity chair = null;
@@ -286,8 +308,8 @@ namespace Content.IntegrationTests.Tests.Buckle
grid.SetTile(coordinates, tile);
human = entityManager.SpawnEntity("HumanMob_Content", coordinates);
chair = entityManager.SpawnEntity("ChairWood", coordinates);
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
// Component sanity check
Assert.True(human.TryGetComponent(out buckle));