问题描述
我一直在寻找目前在.Net中提供的最好的模拟框架。 我比较了不同的工具,如免费以及支付的MOQ,Rhino Mock,Just Mock,TypeMock等,但仍然无法确定哪个是最好的
长期。工具应具有模拟抽象类,inerface,虚方法,静态类,静态方法和密封类的功能。
I was looking for best Mocking framework that is available presently in .Net. I compared different tool like free as well as paid like MOQ, Rhino Mock, Just Mock, TypeMock etc but still not able to decide which is best in long term. Tool should have feature to mock abstract class , inerface, virtual method, static class, static method and sealed class.
推荐答案
据我所知,
微软的摩尔数是个不错的选择。 Moles可用于静态类,以及您无法控制的外部程序集中的方法和类。 Moles使用CLR分析器并执行运行时检测。
As far as I know, Moles of Microsoft is a good choice. Moles can be used on static classes, and methods and classes from external assemblies where you don’t have control. Moles use CLR profiler and do the run time instrumentation.
以下MSDN文档介绍了如何使用Moles,其中包含一个样本。希望对您有所帮助。
Following MSDN document introduce how to use Moles, which contains a sample. Hope that could help you.
但我认为不同的工具有自己的功能。熟悉的工具应该是最好的工具,因为它可以帮助您快速,正确地解决问题。所以我建议你选择你熟悉的那个。
But I think different tool has its own feature. The familiar tool should be the best one because when it could help you resolve your problem quickly and properly. So I suggest you choose the one you are familiar.
最好的问候,
Weiwei
Best Regards,
Weiwei
这篇关于除MSVS 2015专业版中没有的Microsoft Fake以外哪个最好的模拟框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!