开发者

What are the differences between MOQ and AutoFixture?

I have a fair amount of experience using MOQ, while I've recently have stumbled into AutoFixture. What are the differences between these frame开发者_JS百科works?


The FAQ explains the difference. In short

AutoFixture uses Reflection to create 'well-behaved' instances of public types. It auto-generates instances of other types if necessary to fill in arguments for a constructor, and also assigns values to public writable properties. In essence, it simply uses the requested type's public API to instantiate and populate it. It doesn't do anything that you, as a developer, couldn't do manually - it just does it for you automatically.

In contrast, most Dynamic Mock libraries derive from known types to override the behavior of virtual members. Their purpose is to perform Behavior Verification of the System Under Test (SUT).

You can combine AutoFixture with Moq to turn it into an automocking container.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜