// The 'ICustomerPriceCalculatorFactory' is being injected via the constructor since we are using an IoC container that supports ctor injections only. // With a more sophisticated IoC container it would be best to inject this service in the 'IAmountCalculator.Calculate()'. public InvoiceBuilder( ICurrencyRateConverter converter, IPriceCalculatorFactory calculatorFactory) { _invoice = new Invoice(); _converter = converter; _calculatorFactory = calculatorFactory; }
public CompanyPriceCalculator(ICurrencyRateConverter converter) : base(converter) { }
public PriceCalculator(ICurrencyRateConverter converter) { this.converter = converter; }
public IndividualPriceCalculator(ICurrencyRateConverter converter) : base(converter) { }
internal static IDictionary <CustomerType, Func <IPriceCalculator> > GetPriceCalculators(ICurrencyRateConverter converter) => new Dictionary <CustomerType, Func <IPriceCalculator> >() { { CustomerType.Individual, () => new IndividualPriceCalculator(converter) }, { CustomerType.Company, () => new CompanyPriceCalculator(converter) } };