IW4M-Admin/Tests/ApplicationTests/Mocks/DatabaseContextFactoryMock.cs

20 lines
612 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database;
using SharedLibraryCore.Interfaces;
using System;
using SharedLibraryCore.Database.MigrationContext;
namespace ApplicationTests.Mocks
{
class DatabaseContextFactoryMock : IDatabaseContextFactory
{
public DatabaseContext CreateContext(bool? enableTracking)
{
var contextOptions = new DbContextOptionsBuilder<SqliteDatabaseContext>()
.UseInMemoryDatabase(databaseName: "database")
.Options;
return new SqliteDatabaseContext(contextOptions);
}
}
}