Mac and iPhone Applications With Unit Tests, Refactored
Dave Dribin refactors and improves Matt Gallagher’s sample test-driven Cocoa application:
The problem is that Matt’s code is testing the string formatting by asserting the web view’s HTML and text field’s strings. Separating the responsibility of formatting the strings from updating the UI not only improves the design, but makes testing much simpler.