using System;
using System.Reflection;
using System.Runtime.InteropServices;
using NUnit.Framework;
using PkmnLibSharp.Battling;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharpTests
{
    [SetUpFixture]
    public sealed class TestClass
    {
        [OneTimeSetUp]
        public void Init()
        {
            NativeLibrary.Load("Arbutils", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
            NativeLibrary.Load("CreatureLib", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
            NativeLibrary.Load("pkmnLib", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);

            LogHandler.RegisterListener((level, s) =>
            {
                Console.WriteLine($"[{level.ToString().ToUpperInvariant()}] {s}");
            });
            
            SignalHandler.SetSignalListener(s => throw new Exception("Encountered a catastrophic signal. \n" + s));
        }
    }
}