A bit of reflection may help…

when unit tests call legacy code.

It can be tricky adding unit tests to your code if it calls legacy code that can’t be changed for one reason or other. In some cases, it might be possible to use reflection to your advantage.

Under consideration today are cases where the call to the legacy code can be intercepted by instantiating a private/internal variable, instance or static, which is usually checked before calling a service/database etc.

Continue reading

Advertisements