You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
669 B
27 lines
669 B
using DbContextLib;
|
|
using Microsoft.Data.Sqlite;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using StubbedContextLib;
|
|
|
|
namespace UnitTestsEntities;
|
|
|
|
public class DatabaseFixture : IDisposable
|
|
{
|
|
public readonly SqliteConnection _connection;
|
|
public readonly DbContextOptions<HeartTrackContext> _options;
|
|
public DatabaseFixture()
|
|
{
|
|
_connection = new SqliteConnection("DataSource=:memory:");
|
|
_connection.Open();
|
|
|
|
_options = new DbContextOptionsBuilder<HeartTrackContext>()
|
|
.UseSqlite(_connection)
|
|
.Options;
|
|
|
|
}
|
|
public void Dispose()
|
|
{
|
|
_connection.Close();
|
|
_connection.Dispose();
|
|
}
|
|
} |