Unit Test to Run .sql script to SQL Create Database

Posted by Lee Englestone on Stack Overflow See other posts from Stack Overflow or by Lee Englestone
Published on 2010-03-29T09:39:55Z Indexed on 2010/03/29 9:43 UTC
Read the original article Hit count: 340

Filed under:
|
|

Can anyone point me in the direction of how I could get a NUnit test to run a .sql file to Create / Setup a database.

I know about the the TestFixtureSetUp and TestFixtureTearDown attributes / methods in NUnit.

So I KNOW how to call methods before and after all or each unit tests.

I'm just unsure of how to load and execute the contents of a .sql file agains a SQL Server 2005 database programatically.

Any examples?

This is part of our TDD / CI. We are wanting to create the database before and tear down the database after executing unit tests.

Cheers,

-- Lee

© Stack Overflow or respective owner

Related posts about ci

Related posts about TDD