Reputation: 2708
I am using Visual Studio to test some insert and delete methods in the database. I need to have separate testing methods for the insert and delete methods.
My problem is that I can't test either of the methods if one of them doesn't work. I can't have duplicate entries in the database and I should have a fixed entry that I insert in the database and that same entry should be deleted when I test the delete method.
Is there a best practice for such test that depend on each other?
Upvotes: 0
Views: 156
Reputation: 4504
if you want you tests to go to the database, then you could pre-populate the database with known data.
as you execute your logic, you can ensure the state of the db has changed correctly.
a lib already exists to help https://code.google.com/p/ndbunit/
Upvotes: 1