Skip to content

Commit

Permalink
Utilize nunit TestContext instead of console
Browse files Browse the repository at this point in the history
  • Loading branch information
SignatureBeef committed Jan 3, 2025
1 parent d597325 commit 38d4276
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions TerrariaServerAPI.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ public class BaseTest
[OneTimeSetUp]
public void EnsureInitialised()
{
TestContext.Out.WriteLine($"Test architecture {RuntimeInformation.ProcessArchitecture}");

if (!_initialized)
{
var are = new AutoResetEvent(false);
AutoResetEvent are = new(false);
Exception? error = null;
HookEvents.HookDelegate<global::Terraria.Main,HookEvents.Terraria.Main. DedServEventArgs> cb = (instance, args) =>
HookEvents.HookDelegate<global::Terraria.Main, HookEvents.Terraria.Main.DedServEventArgs> cb = (instance, args) =>
{
instance.Initialize();
are.Set();
_initialized = true;
Console.WriteLine($"Server init process successful for architecture {RuntimeInformation.ProcessArchitecture}");
};
HookEvents.Terraria.Main.DedServ += cb;

global::TerrariaApi.Server.Program.Main(new string[] { });
global::TerrariaApi.Server.Program.Main([]);

_initialized = are.WaitOne(TimeSpan.FromSeconds(30));

Expand Down

0 comments on commit 38d4276

Please sign in to comment.