We’ve struggled with database unit testing on our NxOpinion project, if only because we’re using a third-party object-relational mapping tool that doesn’t normally expose its transaction. Fortunately, we were able to make some slight code modifications to expose the transaction, and we’ve been successfully using a rollback technique to preserve the integrity of our test data. But because we don’t want to maintain a dependency on the third-party mapping tool, we’re in the process of writing our own database unit testing framework. Roy Osherove has posted a recent article titled Simplified Database Unit testing using Enterprise Services that provides an overview and some good insight into another possible solution.
Update: James Newkirk points out a series of related articles by Steve Eichert.