Tight coupling

Coupling is the extent to which objects depend on or are closely related to one another. To explain this further, when a LoanProcessor class is tightly coupled to EligibilityChecker, changing the latter can affect the behavior or modify the state of the former.

The majority of untestable code is usually a result of inherent dependencies scattered in different portions of the codes, usually through the use of concrete implementations of dependencies causing a mixing of concerns that otherwise should be separated across application boundaries.

Unit testing code with tightly coupled dependencies will lead to testing the different objects that are tightly coupled. Dependencies that should ideally be easy to mock when injected into ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.