How to decouple my data layer better and restrict the scope of my unit tests?
问题 I'm getting to grips with unit testing and learning how to break up my code into testable bits, but one thing I'm not clear on is how I can write my 'higher-level' code, such as my controller actions, so that testing the controller doesn't require going through the actual data layer (which is independently tested elsewhere in my test suite). For example - I have a user validation which takes a username/password and validates their account and returns login success/failure: class Api