Active Record and Fake In Memory Repositories in Test Driven Development

Introduction Here is a simple example of how to use fake repositories in test driven development. By using Fake Repositories generated from a binary file we are able to quickly use ‘real data’ in all our tests. It is a Visual Studio 2008 solution and uses the Castle project’s Active Record as an ORM. Step 1 – Our Core Model The model will consist of 3 classes - SuperHero e.g. Superman - SupeHeroId - RealName - SuperHeroName - Power e.g. Flight - PowerId - PowerName - SuperHeroPower e.g. Superman’s flight - SuperHeroPowerId - Comments (e.g. Faster than a speeding bullet) Each of our classes implements an Interface called IIdRetriever ...

August 2008 · Smart Tech