Files
crystall-punk-14/Content.IntegrationTests/Tests/GameRules/SecretStartsTest.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2023-04-25 20:23:14 -04:00
using System.Linq;
using Content.Server.GameTicking;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.GameRules;
[TestFixture]
public sealed class SecretStartsTest
{
/// <summary>
/// Tests that when secret is started, all of the game rules it successfully adds are also started.
/// </summary>
[Test]
public async Task TestSecretStarts()
{
2023-08-25 02:56:51 +02:00
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Dirty = true });
2023-08-25 02:56:51 +02:00
var server = pair.Server;
await server.WaitIdleAsync();
var gameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
await server.WaitAssertion(() =>
{
2023-04-25 20:23:14 -04:00
gameTicker.StartGameRule("Secret");
});
// Wait three ticks for any random update loops that might happen
await server.WaitRunTicks(3);
await server.WaitAssertion(() =>
{
2023-04-25 20:23:14 -04:00
foreach (var rule in gameTicker.GetAddedGameRules())
{
Assert.That(gameTicker.GetActiveGameRules(), Does.Contain(rule));
}
// End all rules
gameTicker.ClearGameRules();
});
2023-08-25 02:56:51 +02:00
await pair.CleanReturnAsync();
}
}