I have googled this a little and didn\'t really find the answer I needed.
I am working on a webpage in C# with SQL Server and LINQ for a customer. I want the users
Unit testing databases can be a PITA due to the very nature of them (persisted storage).
To do this right, you should always start with a blank schema. Then have your testing code load fill in the data values that have to be there. This can be as simple as just executing a sql script which contains the schema and default data.
Once that is done, then start running your tests. Tests should encompass all of the crud operations your app will normally do.
If any failure occurs, it's not that big a deal because, again, you should start fresh every time any how.
Also, you want to keep that data around in case of a testing failure so that you can inspect the database state at the time the failure occurred. So, this is both a good and bad thing.
Along these lines, the db tests should be run on it's own test database instance. This way you don't have to worry about transient issues like someone changing a db structure underneath you as the tests are progressing.
Ultimately, database testing is a project in and of itself.