mobile menu icon

Polymorphic test setup with template method

Published by Carlos Blé on 21/12/2015

C#, .Net, Refactoring, Design Patterns, Testing, Contract Testing, Role Testing


We had a kind of duplication in our tests that we didn’t know how to deal with. The refactoring Introduce Polymorphic Creation with Factory Method explained by Joshua Kerievsky in his brilliant book “Refactoring to Patterns” gave us the solution to avoid duplicated tests.