This project is read-only.

Integration testing - Rollback?

Jan 13, 2011 at 2:35 PM

Hi all,

I'm integration testing my DAL, is there anyway to do a rollback of the database (after each test) through nHydrate generated code? Cheers,


Jan 14, 2011 at 7:45 PM

There is no rollback functionality. Once you have updated your database it has changed. Since the installation project and DAL are generated you can do this. In your tests simply create a new database, populate it with test data and run your tests. Afterward in the tear down, simply delete the temp database. The installer can programmatically create a database for you. There is no reason to use an existing one. In fact you should not since you want your database to be in a specific state for the tests. I would argue to dynamically create one on the fly and test against it.

Jan 17, 2011 at 8:36 AM
Edited Jan 17, 2011 at 12:51 PM

Yep, that'll do what I need. Cheers!