Fix tests.
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Content.IntegrationTests
|
|||||||
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ClientIntegrationOptions();
|
options ??= new ClientIntegrationOptions();
|
||||||
|
options.ExtraAssemblies = new[] {typeof(ContentIntegrationTest).Assembly};
|
||||||
|
|
||||||
// ReSharper disable once RedundantNameQualifier
|
// ReSharper disable once RedundantNameQualifier
|
||||||
options.ClientContentAssembly = typeof(EntryPoint).Assembly;
|
options.ClientContentAssembly = typeof(EntryPoint).Assembly;
|
||||||
@@ -53,6 +54,7 @@ namespace Content.IntegrationTests
|
|||||||
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ServerIntegrationOptions();
|
options ??= new ServerIntegrationOptions();
|
||||||
|
options.ExtraAssemblies = new[] {typeof(ContentIntegrationTest).Assembly};
|
||||||
options.ServerContentAssembly = typeof(Server.EntryPoint).Assembly;
|
options.ServerContentAssembly = typeof(Server.EntryPoint).Assembly;
|
||||||
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
||||||
options.BeforeStart += () =>
|
options.BeforeStart += () =>
|
||||||
@@ -89,7 +91,9 @@ namespace Content.IntegrationTests
|
|||||||
return StartServer(options);
|
return StartServer(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 client = StartClient(clientOptions);
|
||||||
var server = StartServer(serverOptions);
|
var server = StartServer(serverOptions);
|
||||||
@@ -100,7 +104,9 @@ namespace Content.IntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected async Task<(ClientIntegrationInstance client, ServerIntegrationInstance server)> StartConnectedServerDummyTickerClientPair(ClientIntegrationOptions clientOptions = null, ServerIntegrationOptions serverOptions = null)
|
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);
|
||||||
@@ -136,7 +142,8 @@ namespace Content.IntegrationTests
|
|||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int maxTicks = 600, int tickStep = 1)
|
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int maxTicks = 600,
|
||||||
|
int tickStep = 1)
|
||||||
{
|
{
|
||||||
var ticksAwaited = 0;
|
var ticksAwaited = 0;
|
||||||
bool passed;
|
bool passed;
|
||||||
@@ -160,7 +167,8 @@ namespace Content.IntegrationTests
|
|||||||
Assert.That(passed);
|
Assert.That(passed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task StartConnectedPairShared(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
private static async Task StartConnectedPairShared(ClientIntegrationInstance client,
|
||||||
|
ServerIntegrationInstance server)
|
||||||
{
|
{
|
||||||
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
||||||
|
|
||||||
@@ -174,7 +182,8 @@ namespace Content.IntegrationTests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs <paramref name="ticks"/> ticks on both server and client while keeping their main loop in sync.
|
/// Runs <paramref name="ticks"/> ticks on both server and client while keeping their main loop in sync.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static async Task RunTicksSync(ClientIntegrationInstance client, ServerIntegrationInstance server, int ticks)
|
protected static async Task RunTicksSync(ClientIntegrationInstance client, ServerIntegrationInstance server,
|
||||||
|
int ticks)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < ticks; i++)
|
for (var i = 0; i < ticks; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user