Hopefully, this discussion thread throws some more light on the matter.
In short, it served as an example, but isn't one of the highlights of the book. I would typically not write code like that on purpose in real production code bases.
However, I disagree that HomeController
is untestable, because I wrote the entire code base for the book using Test-Driven Development. You can download the code for the book and verify that it's covered by tests. However, I do agree that HomeController
is more difficult to unit test than it could have been.
For the record, I make mistakes while coding, just like anyone else...