views:

71

answers:

1

I have an application extension which I need to test. Part of the extension applies some updates to the application database schema (via the applications API). i want to test that given version 1 of the application when my class is run the schema becomes v1.1 and that certain queries for items which should exist in 1.1 return correctly. I have backup of the database at schema v1.0 and what I would like to do in my tests is:

1/ restore the database from a backup

2/ call the code which does the update

3/ call several methods which verify that the schema updates have succeeded

4/restore the database from a backup

Are there classes I can use to do this restore in my c# code, or do I have to execute the command in shell process?

+2  A: 

If you are uysing SQL Server, you could use the SQL Management objects (SMO)

An example can be found here

Kindness,

Dan

Daniel Elliott
Thanks just what I was looking for
Sam Holder