Clear the problem:
First, when we do unit tests on a, we may find that the implementation of a must depend on B. At this point, when we write the unit test, we must first create an instance of B, and then pass B to a and then create an instance of a to test.
This will cause some problems:
1, our unit testing will become complex and fragile. It's complicated because we have to spend our energy figuring out the logic of B. Fragility is because if the logic of B changes, we may also face a failure in unit testing of a.
2, more importantly, when we failed in the test, we can not quickly locate whether it is a problem or B.
So we use the MOQ technique to mock "forge" an instance of B, so that we can focus on unit testing of a.
The next step is to record how MOQ is used.
"PRO asp.ne MVC4 Study notes" using MOQ to assist with unit testing