O'Reilly logo

Refactoring with Microsoft Visual Studio 2010 by Peter Ritchie

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

Unit testing existing legacy code

If we already have unit tests for a particular portion of code, then we can reasonably be sure that we can detect whether changes to this code has caused any changes in external behavior.

As we detailed in a previous chapter, legacy code is code that has no automated tests associated with it. There's two realistic ways to deal with legacy code that we detailed in the previous chapter: to go ahead and evolve it, or to decouple it from its dependants and treat it like a third party library that we don't have control over.

When you're refactoring code, that refactoring is often to redesign the code to follow principles like loosely-coupled. True unit-testing is possible only if the code is loosely-coupled. This is ...

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