using DbConnectionLibrairie; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace UnitTestsEntityManagers { /// /// an abstract class to init the dbContext /// (every unit tests need to implement it) /// public abstract class AbstractUnitTestEM { protected MyDbContext dbContext; /// /// constructor of the class : /// initialise the dbContext /// public AbstractUnitTestEM() { var opt = new DbContextOptionsBuilder() .UseSqlite("DataSource=:memory:") .Options; dbContext = new MyDbContext(opt); } /// /// destructor of the class : /// dispose the database context /// ~AbstractUnitTestEM() { dbContext.DisposeAsync(); } } }