Code Cleanup: Integration Tests (#29584)

* Cleanup PuddleTest

* Cleanup GravityGridTest

* Cleanup PowerTest

* Cleanup SaveLoadMapTest

* Cleanup Body tests

* Cleanup ContainerOcclusionTest

* Cleanup AirlockTest

* Cleanup DamageableTest

* Cleanup EntityTest

* Cleanup FluidSpillTest

* Cleanup FollowerSystemTest

* Cleanup HandCuffTest

* Cleanup InteractionSystemTests

* Cleanup InRangeUnobstructed

* Cleanup SimplePredictReconcileTest

* Cleanup PostMapInitTest

* Cleanup SalvageTest

* Cleanup SaveLoadSaveTest

* Cleanup ShuttleTest

* Cleanup MaterialArbitrageTest

* Cleanup PrototypeSaveTest

* Fix ShuttleTest

* Bunch of small ones

* Move JobTests to Station directory

* More small fixes

* Cleanup InteractionTest.Helpers
Had to change a method signature, so some callers were modified too.

* Missed one
This commit is contained in:
Tayrtahn
2024-07-02 20:01:37 -04:00
committed by GitHub
parent 58d46ddd46
commit cfc0247e5c
56 changed files with 510 additions and 491 deletions

View File

@@ -2,7 +2,6 @@
using System.Linq;
using Content.Server.Construction.Components;
using Content.Shared.Construction.Components;
using Content.Shared.Prototypes;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
@@ -37,6 +36,7 @@ public sealed class MachineBoardTest
var server = pair.Server;
var protoMan = server.ResolveDependency<IPrototypeManager>();
var compFact = server.ResolveDependency<IComponentFactory>();
await server.WaitAssertion(() =>
{
@@ -45,7 +45,7 @@ public sealed class MachineBoardTest
.Where(p => !pair.IsTestPrototype(p))
.Where(p => !_ignoredPrototypes.Contains(p.ID)))
{
if (!p.TryGetComponent<MachineBoardComponent>(out var mbc))
if (!p.TryGetComponent<MachineBoardComponent>(out var mbc, compFact))
continue;
var mId = mbc.Prototype;
@@ -53,7 +53,7 @@ public sealed class MachineBoardTest
{
Assert.That(protoMan.TryIndex<EntityPrototype>(mId, out var mProto),
$"Machine board {p.ID}'s corresponding machine has an invalid prototype.");
Assert.That(mProto.TryGetComponent<MachineComponent>(out var mComp),
Assert.That(mProto.TryGetComponent<MachineComponent>(out var mComp, compFact),
$"Machine board {p.ID}'s corresponding machine {mId} does not have MachineComponent");
Assert.That(mComp.Board, Is.EqualTo(p.ID),
$"Machine {mId}'s BoardPrototype is not equal to it's corresponding machine board, {p.ID}");
@@ -75,6 +75,7 @@ public sealed class MachineBoardTest
var server = pair.Server;
var protoMan = server.ResolveDependency<IPrototypeManager>();
var compFact = server.ResolveDependency<IComponentFactory>();
await server.WaitAssertion(() =>
{
@@ -83,7 +84,7 @@ public sealed class MachineBoardTest
.Where(p => !pair.IsTestPrototype(p))
.Where(p => !_ignoredPrototypes.Contains(p.ID)))
{
if (!p.TryGetComponent<ComputerBoardComponent>(out var cbc))
if (!p.TryGetComponent<ComputerBoardComponent>(out var cbc, compFact))
continue;
var cId = cbc.Prototype;
@@ -92,7 +93,7 @@ public sealed class MachineBoardTest
Assert.That(cId, Is.Not.Null, $"Computer board \"{p.ID}\" does not have a corresponding computer.");
Assert.That(protoMan.TryIndex<EntityPrototype>(cId, out var cProto),
$"Computer board \"{p.ID}\"'s corresponding computer has an invalid prototype.");
Assert.That(cProto.TryGetComponent<ComputerComponent>(out var cComp),
Assert.That(cProto.TryGetComponent<ComputerComponent>(out var cComp, compFact),
$"Computer board {p.ID}'s corresponding computer \"{cId}\" does not have ComputerComponent");
Assert.That(cComp.BoardPrototype, Is.EqualTo(p.ID),
$"Computer \"{cId}\"'s BoardPrototype is not equal to it's corresponding computer board, \"{p.ID}\"");