using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;

namespace PkmnLib.Plugin.Gen7.Tests.Scripts;

public class GenericScriptTests
{
    [Test]
    public async Task EveryScriptHasAttribute()
    {
        var scripts = typeof(Gen7Plugin).Assembly.GetTypes()
            .Where(t => t.IsSubclassOf(typeof(Script)) && !t.IsAbstract);
        foreach (var script in scripts)
        {
            var attributes = script.GetCustomAttributes(typeof(ScriptAttribute), false);
            await Assert.That(attributes).IsNotEmpty().Because(
                $"Script {script.Name} does not have the Script attribute defined.");
        }
    }
}