Roy Osherove has written a useful library that adds support for wrapping your unit tests inside a transaction (using MSDTC/COM+) which means that you can test your data-layer code and not worry about messing up your database.

The only problem is I can't get it working for me:-(

  1. Microsoft increased the security around using COM+ in Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1
  2. The database I'm testing against is on a remote server (running 2003 SP1)

So even after reading this KB article, I still can't get it to work. The unit test just hangs, and I think it's because MSDTC is having problems of some kind.