Fix content.integration tests warnings (#17817)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Systems;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -85,10 +83,22 @@ public sealed class SaveLoadReparentTest
|
||||
});
|
||||
}
|
||||
|
||||
Assert.That(entities
|
||||
.EntityQuery<BodyComponent>()
|
||||
.Where(e => entities.GetComponent<MetaDataComponent>(e.Owner).EntityPrototype!.Name ==
|
||||
"HumanBodyDummy"), Is.Not.Empty);
|
||||
// Converts an entity query enumerator to an enumerable.
|
||||
static IEnumerable<(EntityUid Uid, TComp Comp)> EnumerateQueryEnumerator<TComp>(EntityQueryEnumerator<TComp> query)
|
||||
where TComp : Component
|
||||
{
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
yield return (uid, comp);
|
||||
}
|
||||
|
||||
Assert.That(
|
||||
EnumerateQueryEnumerator(
|
||||
entities.EntityQueryEnumerator<BodyComponent>()
|
||||
).Where((e) =>
|
||||
entities.GetComponent<MetaDataComponent>(e.Uid).EntityPrototype!.Name == "HumanBodyDummy"
|
||||
),
|
||||
Is.Not.Empty
|
||||
);
|
||||
|
||||
const string mapPath = $"/{nameof(SaveLoadReparentTest)}{nameof(Test)}map.yml";
|
||||
|
||||
@@ -96,22 +106,26 @@ public sealed class SaveLoadReparentTest
|
||||
maps.DeleteMap(mapId);
|
||||
|
||||
mapId = maps.CreateMap();
|
||||
mapLoader.LoadMap(mapId, mapPath);
|
||||
Assert.That(mapLoader.TryLoad(mapId, mapPath, out _), Is.True);
|
||||
|
||||
var query = entities
|
||||
.EntityQuery<BodyComponent>()
|
||||
.Where(e => entities.GetComponent<MetaDataComponent>(e.Owner).EntityPrototype!.Name == "HumanBodyDummy")
|
||||
.ToArray();
|
||||
var query = EnumerateQueryEnumerator(
|
||||
entities.EntityQueryEnumerator<BodyComponent>()
|
||||
).Where((e) =>
|
||||
entities.GetComponent<MetaDataComponent>(e.Uid).EntityPrototype!.Name == "HumanBodyDummy"
|
||||
).ToArray();
|
||||
|
||||
Assert.That(query, Is.Not.Empty);
|
||||
foreach (var body in query)
|
||||
foreach (var (uid, body) in query)
|
||||
{
|
||||
human = body.Owner;
|
||||
human = uid;
|
||||
parts = bodySystem.GetBodyChildren(human).ToArray();
|
||||
organs = bodySystem.GetBodyOrgans(human).ToArray();
|
||||
|
||||
Assert.That(parts, Is.Not.Empty);
|
||||
Assert.That(organs, Is.Not.Empty);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(parts, Is.Not.Empty);
|
||||
Assert.That(organs, Is.Not.Empty);
|
||||
});
|
||||
|
||||
foreach (var (id, component) in parts)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user