fix(git-tests): Create per-test specific databases

This commit is contained in:
Scott 2026-09-05 12:57:54 +10:00
commit cf782211aa
3 changed files with 40 additions and 6 deletions

View file

@ -17,6 +17,8 @@ public class GitManager
private GitManager(string? databaseName = null)
{
_registrations = new ConcurrentDictionary<string, InternalGitRegistration>();
// Regular usage of this constructor will never pass a database name in. Currently only tests should be hitting
// a code path that has a different database name
_db = new DatabaseManager(databaseName ?? "git.db");
InitialiseRegistrations();
@ -29,6 +31,14 @@ public class GitManager
/// </summary>
internal static GitManager InternalFreshInstance(string databaseName) => new(databaseName);
/// <summary>
/// Deletes the underlying database file.
/// <para>
/// Avoid calling this outside of tests.
/// </para>
/// </summary>
internal void DeleteDatabase() => _db.DeleteDatabase();
/// <summary>
/// Creates up any database tables and loads all previously saved git registrations.
/// </summary>