Add role prototype validation tests (#32801)

* Add role prototype validation test

* Rejig GetPrototypesWithComponent

* More tests n stuff
This commit is contained in:
Leon Friedrich
2024-10-14 16:05:25 +13:00
committed by GitHub
parent 870eb439f3
commit 4e0018697f
9 changed files with 241 additions and 125 deletions

View File

@@ -94,14 +94,13 @@ namespace Content.IntegrationTests.Tests
await Assert.MultipleAsync(async () =>
{
foreach (var proto in pair.GetPrototypesWithComponent<StorageFillComponent>())
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<StorageFillComponent>())
{
if (proto.HasComponent<EntityStorageComponent>(compFact))
continue;
StorageComponent? storage = null;
ItemComponent? item = null;
StorageFillComponent fill = default!;
var size = 0;
await server.WaitAssertion(() =>
{
@@ -112,7 +111,6 @@ namespace Content.IntegrationTests.Tests
}
proto.TryGetComponent("Item", out item);
fill = (StorageFillComponent) proto.Components[id].Component;
size = GetFillSize(fill, false, protoMan, itemSys);
});
@@ -179,7 +177,7 @@ namespace Content.IntegrationTests.Tests
var itemSys = entMan.System<SharedItemSystem>();
foreach (var proto in pair.GetPrototypesWithComponent<StorageFillComponent>())
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<StorageFillComponent>())
{
if (proto.HasComponent<StorageComponent>(compFact))
continue;
@@ -192,7 +190,6 @@ namespace Content.IntegrationTests.Tests
if (entStorage == null)
return;
var fill = (StorageFillComponent) proto.Components[id].Component;
var size = GetFillSize(fill, true, protoMan, itemSys);
Assert.That(size, Is.LessThanOrEqualTo(entStorage.Capacity),
$"{proto.ID} storage fill is too large.");