Disease Stages But Epic (#9043)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Nemanja
2022-07-07 23:44:38 -04:00
committed by GitHub
parent 3bfb1f0264
commit 7ec23e020d
5 changed files with 87 additions and 3 deletions

View File

@@ -0,0 +1,48 @@
using System.Threading.Tasks;
using Content.Shared.Disease;
using NUnit.Framework;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests;
[TestFixture]
public sealed class DiseaseTest
{
/// <summary>
/// Asserts that a disease prototype has valid stages for its effects and cures.
/// </summary>
[Test]
public async Task Stages()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server;
var protoManager = server.ResolveDependency<IPrototypeManager>();
await server.WaitAssertion(() =>
{
foreach (var proto in protoManager.EnumeratePrototypes<DiseasePrototype>())
{
var stages = proto.Stages;
foreach (var effect in proto.Effects)
{
for (var i = 0; i < effect.Stages.Length; i++)
{
Assert.That(stages.Contains(i), $"Disease {proto.ID} has an effect with an incorrect stage, {i}!");
}
}
foreach (var cure in proto.Cures)
{
for (var i = 0; i < cure.Stages.Length; i++)
{
Assert.That(stages.Contains(i), $"Disease {proto.ID} has a cure with an incorrect stage, {i}!");
}
}
}
});
await pairTracker.CleanReturnAsync();
}
}