using NUnit.Framework; using System; using System.Diagnostics; using System.Threading; namespace TShockLauncher.Tests; public class ServerInitTests { /// /// This test will ensure that the TSAPI binary boots up as expected /// [TestCase] public void EnsureBoots() { var are = new AutoResetEvent(false); HookEvents.HookDelegate cb = (instance, args) => { args.ContinueExecution = false; are.Set(); Debug.WriteLine("Server init process successful"); }; HookEvents.Terraria.Main.DedServ += cb; new Thread(() => TerrariaApi.Server.Program.Main([])).Start(); var hit = are.WaitOne(TimeSpan.FromSeconds(10)); HookEvents.Terraria.Main.DedServ -= cb; Assert.That(hit, Is.True); } }