Legacy Code to Testable Code #11: MOAR Static Constructors

The other posts in the series: Where we last left off, we discussed how to dismantle the static constructor (or initializer) booby traps. And I promised you an example. I’ll do that in C#, but the operations apply to any… Continue Reading…

Legacy Code to Testable Code #10: Getting Rid of Static Constructors

Here is the rest of the gang: This time we’re going to tackle the most problematic issue in testing object-oriented languages. Obviously because constructors only exist in those, but also, because even power tools have problems handling them. But we’ll start… Continue Reading…

Legacy Code to Testable Code #8: Convert If-Else’s to Guard Blocks

I know, you want to check out the rest of the series. Here are the links: Code simplification is one of the best things we can do for ourselves. If we understand the code, not only will we write simpler… Continue Reading…

Legacy Code To Testable Code #7: Introduce Parameter

You didn’t think we’ve covered everything, did you? Here’s a short reminder of what we got through: Today we’re going to talk about the Introduce Parameter refactoring pattern. This is one of the more useful patterns to clear code from dependencies. Here’s… Continue Reading…

Gil Zilberfeld on test categorization and testability - Which tests we need to write - integration tests, unit tests, system tests, and if we should use TDD.

Creating A Unit Test Strategy – Part II

This is the 2nd part of the series about analyzing what we’re coding, and therefore which unit tests and integration tests to write. Last time, we talked about the problem we want to test (either unit tests, integration tests or… Continue Reading…

Gil Zilberfeld points to one of the refactoring patterns in unit testing and unit tests that makes legacy code more testable.

Legacy Code to Testable Code #6: Add Overload

This post is part of the “Legacy Code to Testable Code” series. In the series we’ll talk about making refactoring steps before writing unit tests for legacy code, and how they make our life easier. Other posts include:   In… Continue Reading…

Gil Zilberfeld points to one of the refactoring patterns in unit testing and unit tests that makes legacy code more testable.

Legacy Code to Testable Code #5: Extract Class

This post is part of the “Legacy Code to Testable Code” series. In the series we’ll talk about making refactoring steps before writing unit tests for legacy code, and how they make our life easier. Other posts include: A few… Continue Reading…

Gil Zilberfeld points to one of the refactoring patterns in unit testing and unit tests that makes legacy code more testable.

Legacy Code to Testable Code #4: More Accessors!

This post is part of the “Legacy Code to Testable Code” series. In the series we’ll talk about making refactoring steps before writing unit tests for legacy code, and how they make our life easier. It continues the last post… Continue Reading…

Gil Zilberfeld's post in the "Legacy Code to Testable Code" on refactoring legacy code for unit testing and unit tests.

Legacy Code to Testable Code #3: Adding Setter Accessors

This post is part of the “Legacy Code to Testable Code” series. In the series we’ll talk about making refactoring steps before writing unit tests for legacy code, and how they make our life easier. Other posts include: Adding accessors… Continue Reading…

Gil Zilberfeld explains refactoring legacy code for writing unit tests, thist ime about method extraction. This pattern allows to unit test and mock methods

Legacy Code To Testable Code #2: Extract Method

This post is part of the “Legacy Code to Testable Code” series. In the series we’ll talk about making refactoring steps before writing unit tests for legacy code, and how they make our life easier. Other posts included: As with… Continue Reading…

Copyright Gil Zilberfeld, 2025