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)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment