Question

Faced with choosing a Dependency Injection Framework in a historically MS shop working with C#, I'm interested in finding out the differences between Moq and Unity.

Some of the main concerns would include:

  • Ease of use for developers with no background in DI
  • Feature comparison between the two (once everyone becomes familiar with the technology).
  • Performance (not sure if this is even an issue)
  • Integration with visual studio, particularly with regards to refactor tools
  • Readability / maintainability
  • Experience when used with other tools such as MEF or EF

Has anyone had any experience in comparing these two? Does anyone have any reasons for choosing one or the other? Are there any others that I should really be considering as well?

Was it helpful?

Solution

As stated by Robert Harvey, Moq is a library for mocking (i.e. replacing a class implementation with one that always returns predictable results), not a dependency injection framework.

You might use Moq with Unity.

For alternative DI suggestions, try here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top