Summary: If you have not already done so, delegate some or all of your advice logic to another class that you can test directly.
概述:如果还没有做的话,可以将一些或者全部建议逻辑委派给其他可以直接测试的类。
Personally I like the idea of keeping all the data access logic encapsulated in that class.
我个人倾向于将所有的数据访问逻辑封装到这个类中。
Design by Contract lets the class designer concentrate on the logic that implements the class functionality without worrying about the validity of arguments.
契约式设计让类的设计者专注于实现了类的功能性的逻辑,而不用担心实参的有效性。
应用推荐