O'Reilly logo

Testing with F# by Mikael Lundin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling your dependencies

Control your dependencies before they take control of you. If you have a unit test where you need to stub out three dependencies, then you're spending more time dealing with the coupling of the SUT than actually testing that it's doing in the right thing. Dependencies are a huge problem in programming and something that needs to be dealt with very carefully.

When you're using a dependency injection framework, you're making life easy for yourself by letting the framework create your object and all its dependencies. This means that there is no problem for you to add more and more dependencies to the class under test, because there is no punishment for doing so. Not until you start writing tests.

When you're writing tests, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required