Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (23 sloc) 693 Bytes
using System;
using Microsoft.EntityFrameworkCore;
using TestDatabase;
namespace Threenine.Data.Tests.TestFixtures
{
public class InMemoryTestFixture : IDisposable
{
public TestDbContext Context => InMemoryContext();
public void Dispose()
{
Context?.Dispose();
}
private static TestDbContext InMemoryContext()
{
var options = new DbContextOptionsBuilder<TestDbContext>()
.UseInMemoryDatabase(Guid.NewGuid().ToString())
.EnableSensitiveDataLogging()
.Options;
var context = new TestDbContext(options);
return context;
}
}
}