DIY Developer

Power tools, software, 3d printing


Auto mocking with AutoMoq

AutoMoq is a nice little package I came across today. The AutoMoq home page describes it as follows:

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

Why is this useful? Consider the following scenario. We have a BananaCakeFactory class, that relies on a Banana Repository. Here is the constructor:

Continue Reading

Nested Dependencies in MVC4

Given how complex the average MVC4 application can become, it is likely that you are going to come across the situation where you build up a dependency chain. It may look like this: Controller -> Provider/Manager -> Dependency

 A common scenario may be that your controller needs a Lookup Manager, and that manager needs a cached query passed in.

In this scenario, the Unity.Mvc4 nuGet package comes into play.

Continue Reading