Ohhh, that’s why I should make a TestRepository…
Listening to the last screencast of Rob Conery (MVC Storefront) made me realize something that I haven’t really understood before.
Suppose you have the interface of a repository, let’s say IEntryRepository. Then you have the actual SqlEntryRepository and TestEntryRepository. When I am doing TDD, I am testing the TestEntryRepository. But it will not be used in production. Why bothering with testing it then?
Because TDD is a design process. Even if I am testing my code, I am also designing it. The SqlEntryRepository will benefits from the actual design of the repository we use for testing.

That’s right. You should really consider that your tests are against IEntryRepository, the interface. The concrete class, TestEntryRepository, is only there to supply some data for the tests. You are actually designing the interface, which will reflect on SqlEntryRepository.
Also, having the test repository will simplify your tests and make them faster, since you won’t have to setup mocking, or reset a database on every test.
Anyway, I really like the MVC Storefront series. It’s a great real-life sample of ASP.NET MVC and TDD, something we don’t see often enough!
I agree with you, it’s really nice to see the application of TDD in a real life scenario.
Good day!,