1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
bitwarden-server/test/Infrastructure.IntegrationTest/TestDatabaseHelpers.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
924 B
C#
Raw Normal View History

using Bit.Infrastructure.EntityFramework.Repositories;
namespace Bit.Infrastructure.IntegrationTest;
public interface ITestDatabaseHelper
{
Database Info { get; }
void ClearTracker();
}
public class EfTestDatabaseHelper : ITestDatabaseHelper
{
private readonly DatabaseContext _databaseContext;
public EfTestDatabaseHelper(DatabaseContext databaseContext, Database database)
{
_databaseContext = databaseContext;
Info = database;
}
public Database Info { get; }
public void ClearTracker()
{
_databaseContext.ChangeTracker.Clear();
}
}
public class DapperSqlServerTestDatabaseHelper : ITestDatabaseHelper
{
public DapperSqlServerTestDatabaseHelper(Database database)
{
Info = database;
}
public Database Info { get; }
public void ClearTracker()
{
// There are no tracked entities in Dapper SQL Server
}
}