ASP.NET MVC: MVC Storefront, Part 2 – Repository Pattern

In this installment, I walk through our Repository implementation and write out the first main set of unit tests. I also structure up the initial service layer methods and interfaces.

In this installment, I walk through our Repository implementation and write out the first main set of unit tests. I also  structure up the initial service layer methods and interfaces.

Previously, On the MVC Storefront

  • Part 1: Architectural Discussion and Overview. I cover the initial architecture here, in part 1, where I discuss the Repository Pattern with Ayende Rahien and Steve Harman. I also ask Phil Haack what’s first: The Test Chicken or the Model Egg.

 UPDATE: You can download Part 1 here and download Part 2 here.

Getting Off The Ground
Finally! I get to code something! Our first set of requirements are pretty simple – which is the way we want em since we’re being Agile:

  1. Users can brows products by Category and SubCategory
  2. Clicking on a Product in the category list shows a Product detail
  3. The product must display culture-specific pricing/descriptions as well as any discount information
  4. Each product can have 0 to many reviews.

I take a pretty good chunk out of the requirements in this session – working on the main setup of the Service layer as well as the Catalog Repository.

I also show you how you can work without a database (and keep working without one) as you test up and build your application from nothing. Ideally when working with TDD, you want to be sure that the your tests which require data are as isolated as possible. In other words – you don’t want bad data to fail your tests.

Technorati Tags: