Tech Breakfast #20 - Unit Testing and Dependency Injection Techniques

Aug 06, 2014

Unit Testing and Dependency Injection Techniques

We’ll use Asp.Net to make it more real Also:

  • StructureMap for IoC/DI.
  • NSubstitute for faking dependencies.
  • NLog as a 3rd party dependency example.

Render a page / partial / widget:

  • Downloads latest currency rate from web service.
  • Serves a cached data before it expires.
  • If a web service call fails, log an error (possibly by email)
  • Should return null model if unable to get result. (view will render N/A state)

We will refactor our code to make it testable.

If you want to play with code use this repo