---
title: "[Article] Simplified Database Unit testing using Enterprise Services"
url: "https://osherove.com/blog/2004/6/19/article-simplified-database-unit-testing-using-enterprise-se.md"
canonical: "https://osherove.com/blog/2004/6/19/article-simplified-database-unit-testing-using-enterprise-se.html"
published: "2004-06-19T16:59:00"
updated: "2004-06-19T16:59:00"
tags: [".Net Original", "Agile Related"]
author: "Roy Osherove"
description: "I was reading Test Driven Development in Microsoft .Net today(great book) - especially the chapter about doing database unit tests, and got this incredible idea in my head. I tested it on my home machine and it worked.…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# \[Article\] Simplified Database Unit testing using Enterprise Services

By Roy Osherove June 19, 2004 In [.Net Original](https://osherove.com/blog/category/net-original), [Agile Related](https://osherove.com/blog/category/agile-related)

**Historical article** · Originally published June 19, 2004; technical details may be outdated.

I was reading [Test Driven Development in Microsoft .Net](https://www.amazon.com/exec/obidos/ASIN/0735619484/iserializable-20) today(great book) - especially the chapter about doing database unit tests, and got this incredible idea in my head. I tested it on my home machine and it worked. I then checked with some trusted people to verify that I'm thinking correctly and after I got an OK I went ahead and wrote an article about it.

This is the result - and I think it's going to change the way I do database testing in .Net in a fundamental way.

It's been a while since I've written an article -it's fun to get back in the saddle :)

[Simplified Database Unit testing using Enterprise Services](http://weblogs.asp.net/rosherove/articles/dbunittesting.aspx)

**Summary:**

_In this article I’ll show what problems we encounter today when we perform unit tests against database related components, and the various ways used to solve these problems. I’ll also show a new method to solve these problems, which is far easier and simpler than any of the others. At the end of this article you will have the tools necessary to do simple and easy unit tests against database related components without the need to write messy cleanup code after your tests._

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Jul 11, 2004

    ### [Introducing: NUnitX and the Rollback attribute - Seamless database rollback with Nunit](https://osherove.com/blog/2004/7/11/introducing-nunitx-and-the-rollback-attribute-seamless-datab.html)

- Jun 20, 2004

    ### [Watch me speak: eXtreme Programming and Agile concepts, at the .Net Architects user group this month](https://osherove.com/blog/2004/6/20/watch-me-speak-extreme-programming-and-agile-concepts-at-the.html)

- Jun 16, 2004

    ### [Implementing the BackgroundWorker component - today(source included)](https://osherove.com/blog/2004/6/16/implementing-the-backgroundworker-component-todaysource-incl.html)

- Jun 16, 2004

    ### [Problem & Solution: Allow only one instance of any MDI child form in your MDI application](https://osherove.com/blog/2004/6/16/problem-amp-solution-allow-only-one-instance-of-any-mdi-chil.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
