Monday, November 5, 2007

Test Driven Developement

To begin our first sample we start VS and create an empty solution. The we add a class library project and call it e.g. DomainObjects. We add a second class library project and call it DomainObjects.Tests. This will be our test project. It is a good practice to always keep your tests in separate projects.

Add a new class to the Test project and call it PersonFixture. I always use the naming convention which takes the name of the class to test and appends a "Fixture" postfix.

We want to start immediately with the testing and as such rely on the infrastructure provided by the Rhino Tools. Add a reference to the Rhino.Commons and the Rhino.Commons.ActiveRecord assemblies. Now the PersonFixture class should inherit from the FixtureBase class (of the namespace Rhino.Commons.ForTesting).

No comments: