Mocking tools for C# on .NET [closed]

好久不见. 提交于 2019-12-07 09:46:25

问题


I'm new to C#/.NET but I've been doing TDD for quite some time now. I want to know what is the best framework that can be used for mocking objects while writing tests in C#?


回答1:


Popular options

  • Rhino
  • Moq
  • TypeMock Isolator

Moq and Rhino are both regular mock/stub framework. TypeMock Isolator is a bit special, as it modifies the IL to allow mocking of types you have no control over. Some like this a lot. Others feel it is too intrusive.




回答2:


Moles allows to replace any .NET method with a delegate. Any method including static methods or methods in sealed types.




回答3:


You can try Rhino Mocks or NMocks



来源:https://stackoverflow.com/questions/2453005/mocking-tools-for-c-sharp-on-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!