How extension methods ruined unit testing and OOP, and a way forward
You probably know I’m an advocate of a particular way of doing extension methods that I call the “Extension Method Entry Point Pattern”, which makes it easier to mock them.
This technique, while very useful and recommended for highly cohesive sets of extension methods over a given API, is not well suited for the kind of finer grained extension methods we see proliferating everywhere that are frequently just helpers to supplement core .NET libraries with perceived (or actual) missing functionality. Things like FormatWith, and a myriad others.
The problem with these extension method libraries is that you’re no longer shipping the *contracts*/interfaces for your APIs but the actual implementations! So, if you were building some kind of pluggable application and providing plugin authors with ...