2021-02-21 22:20:11 +11:00
|
|
|
#nullable enable
|
|
|
|
|
using System.Threading.Tasks;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Storage.Components;
|
2021-02-21 22:20:11 +11:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
|
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2022-06-19 20:22:28 -07:00
|
|
|
public sealed class StorageFillTest
|
2021-02-21 22:20:11 +11:00
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task TestStorageFillPrototypes()
|
|
|
|
|
{
|
2022-06-19 20:22:28 -07:00
|
|
|
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
|
|
|
|
|
var server = pairTracker.Pair.Server;
|
|
|
|
|
|
2021-02-21 22:20:11 +11:00
|
|
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
|
|
|
|
|
|
|
|
|
await server.WaitAssertion(() =>
|
|
|
|
|
{
|
|
|
|
|
foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
|
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
if (!proto.TryGetComponent<StorageFillComponent>("StorageFill", out var storage)) continue;
|
2021-02-21 22:20:11 +11:00
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
foreach (var entry in storage.Contents)
|
2021-02-21 22:20:11 +11:00
|
|
|
{
|
2021-11-28 23:05:13 +11:00
|
|
|
Assert.That(entry.Amount, Is.GreaterThan(0), $"Specified invalid amount of {entry.Amount} for prototype {proto.ID}");
|
|
|
|
|
Assert.That(entry.SpawnProbability, Is.GreaterThan(0), $"Specified invalid probability of {entry.SpawnProbability} for prototype {proto.ID}");
|
2021-02-21 22:20:11 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-06-19 20:22:28 -07:00
|
|
|
await pairTracker.CleanReturnAsync();
|
2021-02-21 22:20:11 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|