Example #1
0
 static void Main(string[] args)
 {
     Console.CancelKeyPress += new ConsoleCancelEventHandler(ExitHandler);
     while (keepRunning)
     {
         Console.WriteLine("Please enter numbers to add");
         var input = Console.ReadLine();
         // In production, would use DI
         try
         {
             var calculatorService =
                 new CalculatorService(new InputProcessorService(new DelimiterHelper()),
                                       new ValidatorService());
             Console.WriteLine($"Your result is: {calculatorService.CalculateToString(input)}");
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
         Console.WriteLine();
     }
 }