Files
tbd-station-14/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs
Acruid 8b5d66050a Console Unify API Changes (#3059)
* Remove unused IChatCommand.

* Lots of refactoring into a shared context.

* Removed ICommonSession from server concmd Execute.

* Added argStr parameter to concmd execute.

* The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands.

* Finally move shells and commands into shared.

* Console commands can now be registered directly without a class in a shared context.

* Engine API Changes.

* Repair rebase damage.

* Update Submodule.
2021-02-01 16:49:43 -08:00

66 lines
2.0 KiB
C#

using System;
using System.Threading.Tasks;
using Content.Server.Commands.GameTicking;
using Content.Server.GameTicking;
using Content.Server.Interfaces.GameTicking;
using Content.Shared;
using NUnit.Framework;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.Commands
{
[TestFixture]
[TestOf(typeof(NewRoundCommand))]
public class RestartRoundTest : ContentIntegrationTest
{
[Test]
[TestCase(true)]
[TestCase(false)]
public async Task RestartRoundAfterStart(bool lobbyEnabled)
{
var (_, server) = await StartConnectedServerClientPair();
await server.WaitIdleAsync();
var gameTicker = server.ResolveDependency<IGameTicker>();
var configManager = server.ResolveDependency<IConfigurationManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
await server.WaitRunTicks(30);
GameTick tickBeforeRestart = default;
server.Assert(() =>
{
configManager.SetCVar(CCVars.GameLobbyEnabled, lobbyEnabled);
Assert.That(gameTicker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
tickBeforeRestart = entityManager.CurrentTick;
var command = new NewRoundCommand();
command.Execute(null, string.Empty, Array.Empty<string>());
if (lobbyEnabled)
{
Assert.That(gameTicker.RunLevel, Is.Not.EqualTo(GameRunLevel.InRound));
}
});
await server.WaitIdleAsync();
await server.WaitRunTicks(5);
server.Assert(() =>
{
var tickAfterRestart = entityManager.CurrentTick;
Assert.That(tickBeforeRestart < tickAfterRestart);
});
await server.WaitRunTicks(60);
}
}
}