mirror of
https://github.com/bitwarden/server.git
synced 2024-12-01 13:43:23 +01:00
61a0efbdfc
* Add Pipeline * Fix Lint * Added a Change * Update Pipeline * Add Multi-Version Support * Use Profile Switch for each profile * Fix MySql * Debug MySql * Use Proper Seperator * Add Allow User Variables=true * Pipeline Work * Expand Config for Postgres * Change Config Key * Add Debug Step * Fix Debug Step * Fix Tests * Add Sleep * Fix Tests * Fix SQL Server Tests * Add Sqlite * Use Context Property * Fix Tests * Fix Test Logger * Update AccountRevisionDate Check * Fix Postgres Time Issues * Formatting and Pipeline Update * Remove Unneeded SqlServer Setting * Update .github/workflows/infrastructure-tests.yml Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com> --------- Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com>
43 lines
924 B
C#
43 lines
924 B
C#
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
|
|
}
|
|
}
|