Integration test to test restartround.
This commit is contained in:
@@ -75,10 +75,28 @@ namespace Content.IntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)> StartConnectedServerClientPair(ClientIntegrationOptions clientOptions = null, ServerIntegrationOptions serverOptions = null)
|
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)> StartConnectedServerClientPair(ClientIntegrationOptions clientOptions = null, ServerIntegrationOptions serverOptions = null)
|
||||||
|
{
|
||||||
|
var client = StartClient(clientOptions);
|
||||||
|
var server = StartServer(serverOptions);
|
||||||
|
|
||||||
|
await StartConnectedPairShared(client, server);
|
||||||
|
|
||||||
|
return (client, server);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)> StartConnectedServerDummyTickerClientPair(ClientIntegrationOptions clientOptions = null, ServerIntegrationOptions serverOptions = null)
|
||||||
{
|
{
|
||||||
var client = StartClient(clientOptions);
|
var client = StartClient(clientOptions);
|
||||||
var server = StartServerDummyTicker(serverOptions);
|
var server = StartServerDummyTicker(serverOptions);
|
||||||
|
|
||||||
|
await StartConnectedPairShared(client, server);
|
||||||
|
|
||||||
|
return (client, server);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task StartConnectedPairShared(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
||||||
|
{
|
||||||
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
||||||
|
|
||||||
client.SetConnectTarget(server);
|
client.SetConnectTarget(server);
|
||||||
@@ -86,8 +104,6 @@ namespace Content.IntegrationTests
|
|||||||
client.Post(() => IoCManager.Resolve<IClientNetManager>().ClientConnect(null, 0, null));
|
client.Post(() => IoCManager.Resolve<IClientNetManager>().ClientConnect(null, 0, null));
|
||||||
|
|
||||||
await RunTicksSync(client, server, 10);
|
await RunTicksSync(client, server, 10);
|
||||||
|
|
||||||
return (client, server);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
{
|
{
|
||||||
// Initialize client & server with text component and system registered.
|
// Initialize client & server with text component and system registered.
|
||||||
// They can't be registered/detected automatically.
|
// They can't be registered/detected automatically.
|
||||||
var (client, server) = await StartConnectedServerClientPair(
|
var (client, server) = await StartConnectedServerDummyTickerClientPair(
|
||||||
new ClientContentIntegrationOption
|
new ClientContentIntegrationOption
|
||||||
{
|
{
|
||||||
// This test is designed around specific timing values and when I wrote it interpolation was off.
|
// This test is designed around specific timing values and when I wrote it interpolation was off.
|
||||||
|
|||||||
24
Content.IntegrationTests/Tests/RestartRoundTest.cs
Normal file
24
Content.IntegrationTests/Tests/RestartRoundTest.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Interfaces.GameTicking;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class RestartRoundTest : ContentIntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task Test()
|
||||||
|
{
|
||||||
|
var (client, server) = await StartConnectedServerClientPair();
|
||||||
|
|
||||||
|
server.Post(() =>
|
||||||
|
{
|
||||||
|
IoCManager.Resolve<IGameTicker>().RestartRound();
|
||||||
|
});
|
||||||
|
|
||||||
|
await RunTicksSync(client, server, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user