Пример #1
0
        static void Main(string[] args)
        {
            var calc = new RPN_Calc();

            try
            {
                if (args.Length == 1)
                {
                    Console.WriteLine(calc.Calculate(args[0]));
                }
                else
                {
                    Console.WriteLine("Enter expression");
                    Console.WriteLine(calc.Calculate(Console.ReadLine()));
                }
            }
            catch (Exception e) when(
                e is RPNCalculatorException ||
                e is ArgumentException
                )
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #2
0
 public void EmptyEntryTest()
 {
     Assert.AreEqual(calc.Calculate(""), 0);
 }