コード例 #1
0
        private static async Task <bool> Calculate(AnnualFeeCalculator calculator, string input)
        {
            var isValid = ProcessUserInput(input, out bool toExit, out int consumption);

            if (!toExit && isValid)
            {
                try
                {
                    var fees = await calculator.CalculateAnnualFee(consumption);

                    PrintResult(fees, calculator.CurrencySymbol);
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    Console.WriteLine("Problem happened: {0}", ex.Message);
                }
            }

            return(toExit);
        }
コード例 #2
0
 public AnnualFeeCalculatorTests()
 {
     this.calculator = CalculatorBuilder.Create(CalculatorBuilder.TariffProviderType.InMemory);
 }