Extension methods for Min/Max plus some tests