public ActionResult GetInput(CalculatorInput input) { if (ModelState.IsValid) { var output = new CalculatorOutput(input); return(View("Results", output)); } else { return(View(input)); } }
public CalculatorOutput Calculate(double grossPay, List <TaxBand> bands, List <TaxBand> natInsuranceBands) { Calculator TaxCalculator = new TaxCalculator(bands); Calculator NatInsuranceCalculator = new NatInsuranceCalculator(natInsuranceBands); var taxDeduction = TaxCalculator.CalculateDeduction(grossPay); var natInsuranceDeducation = NatInsuranceCalculator.CalculateDeduction(grossPay); var output = new CalculatorOutput() { NetPay = grossPay - taxDeduction - natInsuranceDeducation, TaxDeducted = taxDeduction, NationalInsuranceDeducted = natInsuranceDeducation }; return(output); }
public void WhenICallTheCalculateFunction() { TestOutput = new CalculatorOutput(TestInput); }