Twitter LinkedIn Github

JetBrains

Over the weekend I blogged about a recurrent issue I encounter when looking at tests, which is the encapsulation of the Arrange part of the Arrange-Act-Assert pattern in either setup methods or base classes. Although there are justified use-cases for it, the majority of times it’s a sign of a code smell.

The example I put was one of a Controller having too many dependencies, and I was asked a few times how to avoid this problem. The purpose of the blog post was not around this issue itself but around test setups. However, it is a valid question, and one that has been raised over the past months questioning the usage of IoC Containers.

So I wonder, do you think this is a problem? If so, how many dependencies is too many? How would you avoid it?