public void TestSetup() { var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = ":memory:" }; var connectionString = connectionStringBuilder.ToString(); var connection = new SqliteConnection(connectionString); var options = new DbContextOptionsBuilder <SchoolDbContext>() .UseSqlite(connection) .Options; _dbContext = new SchoolDbContext(options); _dbContext.Database.OpenConnection(); _dbContext.Database.EnsureCreated(); _dbContext.EnsureSeeded(); _testController = new ClassesController(_dbContext); }