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.
26 lines
660 B
26 lines
660 B
using Microsoft.Data.Sqlite;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using StubbedContextLib;
|
|
|
|
namespace UnitTestsEntities;
|
|
|
|
public class DatabaseFixture : IDisposable
|
|
{
|
|
private readonly SqliteConnection _connection;
|
|
public readonly DbContextOptions<TrainingStubbedContext> _options;
|
|
public DatabaseFixture()
|
|
{
|
|
_connection = new SqliteConnection("DataSource=:memory:");
|
|
_connection.Open();
|
|
|
|
_options = new DbContextOptionsBuilder<TrainingStubbedContext>()
|
|
.UseSqlite(_connection)
|
|
.Options;
|
|
|
|
}
|
|
public void Dispose()
|
|
{
|
|
_connection.Close();
|
|
_connection.Dispose();
|
|
}
|
|
} |