public static IBooksRepository GetInMemoryBooksRepository(string dbName) { var options = new DbContextOptionsBuilder <LibraryDbContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; var dbContext = new LibraryDbContext(options); dbContext.FillBooksDb(); return(new BooksRepository(dbContext)); }