public TaxCalculation TaxCalculationInspetor(TaxCalculation calculation, IQueryProvider <PostalCode> postalCodes , IProgressiveTaxCalculator progressiveTaxCalculator, IFlatRateTaxCalculator flatRateTaxCalculator, IFlatValueTaxCalculator flatValueTaxCalculator) { var postalCode = calculation.PostalCode; var taxTypeId = postalCodes.Query.Where(i => i.CodeName == postalCode).First().TaxTypeId; calculation = TaxTypeSelector(calculation, (int)taxTypeId, progressiveTaxCalculator, flatRateTaxCalculator, flatValueTaxCalculator); return(calculation); }
public void Setup() { _taxCalculationQueryProvider = A.Fake <IQueryProvider <TaxCalculation> >(); _postalCodeQueryProvider = A.Fake <IQueryProvider <PostalCode> >(); _taxCalculationTypesQueryProvider = A.Fake <IQueryProvider <TaxType> >(); _progressiveRatesQueryProvider = A.Fake <IQueryProvider <ProgressiveRate> >(); _inspector = A.Fake <ITaxInspector>(); _progressiveTaxCalculator = A.Fake <IProgressiveTaxCalculator>(); _flatRateTaxCalculator = A.Fake <IFlatRateTaxCalculator>(); _flatValueTaxCalculator = A.Fake <IFlatValueTaxCalculator>(); }
public AcceleratorController(IQueryProvider <TaxCalculation> taxCalculationsQueryProvider, IQueryProvider <PostalCode> postalCodeQueryProvider , IQueryProvider <TaxType> taxCalculationTypesQueryProvider , IQueryProvider <ProgressiveRate> progressiveRatesQueryProvider , ITaxInspector inspector, IProgressiveTaxCalculator progressiveTaxCalculator, IFlatRateTaxCalculator flatRateTaxCalculator , IFlatValueTaxCalculator flatValueTaxCalculator) { _taxCalculationsQueryProvider = taxCalculationsQueryProvider; _postalCodeQueryProvider = postalCodeQueryProvider; _taxCalculationTypesQueryProvider = taxCalculationTypesQueryProvider; _progressiveRatesQueryProvider = progressiveRatesQueryProvider; _inspector = inspector; _progressiveTaxCalculator = progressiveTaxCalculator; _flatRateTaxCalculator = flatRateTaxCalculator; _flatValueTaxCalculator = flatValueTaxCalculator; }
public TaxCalculation TaxTypeSelector(TaxCalculation calculation, int taxTypeId , IProgressiveTaxCalculator progressiveTaxCalculator, IFlatRateTaxCalculator flatRateTaxCalculator, IFlatValueTaxCalculator flatValueTaxCalculator) { if ((TaxTypeEnum)taxTypeId == TaxTypeEnum.ProgressiveTax) { calculation = progressiveTaxCalculator.ProcessTax(calculation); } else if ((TaxTypeEnum)taxTypeId == TaxTypeEnum.FlatRateTax) { calculation = flatRateTaxCalculator.ProcessTax(calculation); } else if ((TaxTypeEnum)taxTypeId == TaxTypeEnum.FlatValueTax) { calculation = flatValueTaxCalculator.ProcessTax(calculation); } return(calculation); }