Some times you need to test your queries to know that you are bring the correct data.
But it’s so boring to setup the data on the database and then clean-up everything else, then do it over and over again.
There must be a simpler way to do it! We may create the data on the test and delete it again.
What if the data is automatically removed?
In this case, I’m using Entity Framework and Microsoft’s Test Unit tools.
We can achieve it using transactions. We’ll be using .Net’s TransactionScope do do it.
First, we create a TransactionalTest class.
To test this class, I created a test case and then setup a Ordered Test list.
It worked for my needs (: