We have a set of services in .NET 3.5\C# and WCF. The NUnit tests need the services to be running and listening for requests. The services need an updated SQL database to be ready for connection.
Currently the [SetUp] section of the unit test does two tasks:
- Execute the latest SQL scripts to build the database.
- Utilize a System.Diagnostics.Process.Start to run the commandline mode of the services.
It usually works but the services are sensitive for certain schema changes, which sometimes fails them. I'm looking for the best practice for setup the database and then the services, and also making sure the services are down at the end.
The process is run by MSBuild.