Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is AutoFixture AutoMoq?

I was looking at nuget and wanted to import moq when I noticed AutoFixture AutoMoq. I see that AutoFixture is to help write TDD faster but I can't find any examples of AutoMoq and how it is different then AutoFixture.

Can someone point me to this AutoMoq so I can see what it is doing.

like image 837
chobo2 Avatar asked Jan 30 '11 19:01

chobo2


People also ask

What is AutoFixture class?

AutoFixture is an open source library for . NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability.

What is AutoMoqer?

AutoMoqer is an "auto-mocking" container that creates objects for you. Just tell it what class to create and it will create it.

What is AutoFixture Xunit?

AutoFixture is a tool designed to make Test-Driven Development more productive and unit tests more refactoring-safe.

What is AutoMoqCustomization?

The AutoMoqCustomization is the core of the integration of AutoFixture with Moq. By adding an instance of this class to the fixture, requests for non-concrete types will be handled by Moq. var fixture = new Fixture();


1 Answers

In short, AutoFixture.AutoMoq is an extension that turns AutoFixture into an Auto-Mocking Container using the Moq dynamic mock library.

There's also a similar extension for AutoFixture that enables auto-mocking with Rhino Mocks.

This article introduces auto-mocking for AutoFixture: http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx.

Here's a couple of follow-ups:

  • http://blog.ploeh.dk/2010/08/25/ChangingTheBehaviorOfAutoFixtureAutomockingWithMoq.aspx
  • http://blog.ploeh.dk/2010/11/13/RhinoMocksbasedAutomockingWithAutoFixture.aspx
like image 189
Mark Seemann Avatar answered Oct 12 '22 21:10

Mark Seemann