The number one rule when refactoring is to always have tests in place before you start refactoring. Without tests, refactoring becomes a risky endeavor. Written by Mak.
Code that doesn’t have tests is often not designed to be testable. In order to make the code testable, you have to refactor it. See how this seems like an impossible task? The Golden Master test paves the way for being able to safely begin refactoring.
The Golden Master is a saved copy of the output a program generates.
The article reads about:
- What is a Golden Master?
- The untested code
- Hardcode the input
- Capture the output
- Add the output as a variable in the test class
Plenty of code examples written in C# with good explanation for each example. Sweet![Read More]