using DbConnectionLibrairie; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using StubbedDbContextLibrary; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace UnitTestsEntityManagers { /// /// an abstract class to init the dbContext /// (every unit tests need to implement it) /// public abstract class AbstractUnitTestEM { protected DbContextOptions opt; /// /// constructor of the class : /// initialise the database context /// public AbstractUnitTestEM() { } protected void creerOpt(string provider, string connectionString) { if(provider == "sqlite") { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); opt = new DbContextOptionsBuilder() .UseSqlite(connection) .Options; } else { throw new Exception("provider unknown"); } } } }