public void Execute() { var orderAmount = Input.DecimalParse(message: "What is the order amount? "); var state = Input.ParseString(message: "What is the state? "); var taxCalculator = new TaxCalculator(); ITaxResult taxResult = taxCalculator.Calculate(orderAmount, state); taxResult.FormatTo(Console.Out); }
public void Formatting() { var subject = new TaxCalculator(); var result = subject.Calculate(orderAmount: 10m, state: "WI"); var output = new StringWriter(); result.FormatTo(output); Assert.That(output.ToString(), Is.StringContaining("The subtotal is £10.00")); Assert.That(output.ToString(), Is.StringContaining("The tax is £0.55")); Assert.That(output.ToString(), Is.StringContaining("The total is £10.55")); }
public void Taxable_State() { var subject = new TaxCalculator(); var result = subject.Calculate(orderAmount: 10m, state: "WI"); Assert.That(result.Tax(), Is.EqualTo(0.55m)); Assert.That(result.Total(), Is.EqualTo(10.55m)); }