任何人都可以建议一个使用最小起订量框架的分步示例吗
任何人都可以建议一个使用最小起订量框架的分步示例吗?
模拟 objetcs 时必须遵循的任何准则或拇指规则。会有很大帮助。
谢谢。
Can any one suggest a step by step example for using moQ framework.
any guidelines or thumbrules that has to be followed while mocking objetcs . can be much help.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是起订量快速入门
更新:评论... 编写可测试代码的很大一部分涉及删除对您控制范围之外的类/资源的依赖关系。实现此目的的一种非常常见的方法是通过接口而不是具体示例进行对话。
要正确描述它有点太多(特别是因为我刚刚从床上滚下来),所以建议您拿起 Roy Osherove 的《单元测试的艺术》的副本。这是一本相当短的书,充满了很好的建议和大量的摘要信息,可以帮助您熟悉许多单元测试方法。
Here's the moq quick-start
Update: To address your comment... A large part of writing testable code involves removing dependencies on classes/resources outside the scope of your control. A very common approach to doing this is by talking to interfaces instead of concrete examples.
It's a little much to describe properly (especially since I just rolled out of bed), so let suggest you pick up a copy of Roy Osherove's 'The Art of Unit Testing'. It's a fairly short book and is filled with good advice and lots of summary information to get you familiar with many of the approaches to unit testing.
我最近才开始使用 Moq,我不确定这会有多大帮助,但如果您能掌握 Pro ASP.NET MVC Framework 有一个非常好的将 moq 和 NUnit 与 ASP.NET MVC 结合使用的分步示例。
I only started to use Moq recently and I am not sure how much help this will be but if you can get your hands on Chapter 3 of Pro ASP.NET MVC Framework there is a really good step-by-step example of using moq and NUnit with ASP.NET MVC.