mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using System.Collections.Concurrent;
|
|
using NUnit.Framework;
|
|
using static Robust.UnitTesting.RobustIntegrationTest;
|
|
|
|
[SetUpFixture]
|
|
// ReSharper disable once CheckNamespace
|
|
public sealed class RobustIntegrationTestSetup
|
|
{
|
|
public void Shutdown()
|
|
{
|
|
foreach (var client in ClientsReady)
|
|
{
|
|
client.Dispose();
|
|
}
|
|
|
|
ClientsReady.Clear();
|
|
|
|
foreach (var server in ServersReady)
|
|
{
|
|
server.Dispose();
|
|
}
|
|
|
|
ServersReady.Clear();
|
|
}
|
|
|
|
public void PrintTestPoolingInfo()
|
|
{
|
|
string QueueToString(ConcurrentQueue<string> queue, int total)
|
|
{
|
|
return $"({queue.Count}/{total}):\n{string.Join("\n", queue)}\n\n";
|
|
}
|
|
|
|
var totalClients = ClientsPooled.Count + ClientsNotPooled.Count;
|
|
TestContext.Out.WriteLine($"Clients created {QueueToString(ClientsCreated, totalClients)}");
|
|
TestContext.Out.WriteLine($"Clients pooled {QueueToString(ClientsPooled, totalClients)}");
|
|
TestContext.Out.WriteLine($"Clients not pooled {QueueToString(ClientsNotPooled, totalClients)}");
|
|
|
|
var totalServers = ServersPooled.Count + ServersNotPooled.Count;
|
|
TestContext.Out.WriteLine($"Servers created {QueueToString(ServersCreated, totalServers)}");
|
|
TestContext.Out.WriteLine($"Servers pooled {QueueToString(ServersPooled, totalServers)}");
|
|
TestContext.Out.WriteLine($"Servers not pooled {QueueToString(ServersNotPooled, totalServers)}");
|
|
}
|
|
|
|
[OneTimeTearDown]
|
|
public void TearDown()
|
|
{
|
|
Shutdown();
|
|
PrintTestPoolingInfo();
|
|
}
|
|
}
|
|
|