Preloading data with SQLite
It is often desirable to preload the database with test data before running tests. In this recipe, we will show you how to load the in-memory database with data from a SQLite file database.
Getting ready
Complete the previous recipe, Fast-testing with the SQLite in-memory database.
Create a SQLite file database with the desired schema (tables and columns), containing test data. This can be accomplished in a number of ways. Perhaps the easiest is to export an in-memory database using SQLiteLoader.ExportData
from this recipe.
How to do it...
- Add a new class named
SQLiteLoader
using the following code:private static ILog log = LogManager.GetLogger(typeof(SQLiteLoader)); private const string ATTACHED_DB = "asdfgaqwernb"; public ...
Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.