Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"tests now really care about how data is being retrieved from the database".

I'm not sure this correct this case. He mocks the repo. The interface for the repo cares about the intention, the implementation cares about the "how". If your creating a user, you always going to want a "add" to persistent store intention. You don't really care how the add to persistent store is done though, or what persistent store. You just care the service intended to do so.

I have an idea that you if your performing a command, you should mock. The whole points of a command is to coordinate subsystems to perform an action. So you need to check if the right methods were called.

If your performing a query you should stub or in memory db.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: