Method injection
Apply if only one method uses a Dependency or that dependency changes from one call to another.
public interface ICurrencyRateProvider {
int GetCurrencyRate(string currency);
}
public class PaymentService {
public static Money CalculatePayment(ICurrencyRateProvider currencyRate) {
return new Money();
}
}
Pitfalls: - Single Responsibility Principle violation - IoC-Container doesn't inject dependencies into methods