using FreeSql;

namespace WebApi.Test.Repository;

public abstract class RepositoryTestBase : BaseTest, IDisposable
{
    protected IFreeSql FreeSql { get; }

    protected RepositoryTestBase()
    {
        FreeSql = new FreeSqlBuilder()
            .UseConnectionString(DataType.Sqlite, "Data Source=:memory:")
            .UseAutoSyncStructure(true)
            .UseNoneCommandParameter(true)
            .Build();
    }

    public void Dispose()
    {
        try
        {
            FreeSql.Dispose();
        }
        catch
        {
            // ignore
        }
    }
}
