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:
@@ -16,11 +16,20 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
[TestOf(typeof(DoAfterComponent))]
|
||||
public class DoAfterServerTest : ContentIntegrationTest
|
||||
{
|
||||
private const string PROTOTYPES = @"
|
||||
- type: entity
|
||||
name: Dummy
|
||||
id: Dummy
|
||||
components:
|
||||
- type: DoAfter
|
||||
";
|
||||
|
||||
[Test]
|
||||
public async Task TestFinished()
|
||||
{
|
||||
Task<DoAfterStatus> task = null;
|
||||
var server = StartServerDummyTicker();
|
||||
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||
var server = StartServerDummyTicker(options);
|
||||
|
||||
// That it finishes successfully
|
||||
server.Post(() =>
|
||||
@@ -29,7 +38,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
||||
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
|
||||
var cancelToken = new CancellationTokenSource();
|
||||
var args = new DoAfterEventArgs(mob, tickTime / 2, cancelToken.Token);
|
||||
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
||||
@@ -43,7 +52,8 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
public async Task TestCancelled()
|
||||
{
|
||||
Task<DoAfterStatus> task = null;
|
||||
var server = StartServerDummyTicker();
|
||||
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||
var server = StartServerDummyTicker(options);
|
||||
|
||||
server.Post(() =>
|
||||
{
|
||||
@@ -51,7 +61,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
||||
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
|
||||
var cancelToken = new CancellationTokenSource();
|
||||
var args = new DoAfterEventArgs(mob, tickTime * 2, cancelToken.Token);
|
||||
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
||||
|
||||
Reference in New Issue
Block a user