问题
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