简体   繁体   中英

Is Repository pattern suitable only for TDD?

We are defining structure for greenfield project. It contains two user intuitive MVC-4 views & the project is mostly data driven site.

We are not using TDD or write unit-test cases for controllers.

Is there any advantage of using repository layer apart from testablility?

EDIT:

I see a sample project structure here on codeplex and I see solution has been split-ted into 7 different layers, including repository . Wouldn't it be an overkill for two page application?

Absolutely, you should still use it. If you are not going to bother to test your controllers, then put as little code in them as possible. Put all your logic, including data access, in a separate, unit tested, layer.

If what you mean is that you'll be making life as hard as possible by having no unit tests at all, then I'd still recommend its use. It'll encourage writing better code and so will reduce the number of hours you spend stuck in the debugger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM