XT-Unit, Cook Book

A helper for .Net based unit testing framework

Based on the Interception application block by Roy OSherove

By Roy Osherove,   Team Agile

 

 

What’s the idea?

See these links for details on the problems this helper is trying to solve:

http://weblogs.asp.net/rosherove/articles/dbunittesting.aspx

http://weblogs.asp.net/rosherove/archive/2004/07/20/187863.aspx

http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx

 

How do I use it?

 

Let’s say that you have a test fixture that performs various actions in each test against the database, including the basic CRUD operations (Insert, update, etc…).

In order to easily add roll back abilities to your tests do the following:

  1. In your test project, add a reference to the XtUnit assembly or source code project
  2. add a using/imports statement for TeamAgile.XtUnit
  3. Place the “DataRollBack” attribute on your test so that it would  look a little like this one:

 

[Test, DataRollBack]

            public void MyDataRelatedTest()

            {

                  //this method will be performed inside a COM+ transaction

                  //this requires windows XP SP2 or better

                  //Windows Server 2003 works as well.

            }

  1. Note that you MUST be running your test (and database) on a machine that is capable of running COM+1.5, which currently means Windows XP service Pack 2 or windows server 2003
  2. Done!