C# – Default method implementations and constants in interfaces

Starting in C# 7, you can add default method implementations (and constants) to interfaces, like this: This outputs the following: Microsoft’s stated purpose for this feature is that it allows you add methods to an interface without breaking existing implementing classes. That’s nice, but it weakens the concept of interfaces (forcing implementers to adhere to … Read more C# – Default method implementations and constants in interfaces

How to mock static methods

The need to mock static methods in order to add a unit test is a very common problem. It’s often the case that these static methods are in third-party libraries. There are many utility libraries that are completely made up of static methods. While this makes them very easy to use, it makes them really … Read more How to mock static methods