Thursday, December 18, 2008

Unit Testing - Database Entries

I needed to unit test some DB entries.

I got this code sample from a colleague of mine.

[TestMethod()]
public void SaveThisTest()
{
using (var transaction = new TransactionScope())
{
//do the target creation
//do the Assert(s)
//dont call transaction.Complete(); //Not calling it will cause a "rollback"
}
}

And that's it... read more here
(this guy has a different point of view, but I have not tried it)

No comments:

Post a Comment