using StellaOps.Plugin;

namespace StellaOps.Feedser.WebService.Tests;

public class PluginLoaderTests
{
    private sealed class NullServices : IServiceProvider
    {
        public object? GetService(Type serviceType) => null;
    }

    [Fact]
    public void ScansConnectorPluginsDirectory()
    {
        var services = new NullServices();
        var catalog = new PluginCatalog().AddFromDirectory(Path.Combine(AppContext.BaseDirectory, "PluginBinaries"));
        var plugins = catalog.GetAvailableConnectorPlugins(services);
        Assert.NotNull(plugins);
    }

    [Fact]
    public void ScansExporterPluginsDirectory()
    {
        var services = new NullServices();
        var catalog = new PluginCatalog().AddFromDirectory(Path.Combine(AppContext.BaseDirectory, "PluginBinaries"));
        var plugins = catalog.GetAvailableExporterPlugins(services);
        Assert.NotNull(plugins);
    }
}
