示例#1
0
        public void Run(string[] args)
        {
            cli = new CLI(args);
            cli.Run();


            var arguments = new CLI(args).ReadArguments <CalcArguments>();

            argumentExpression = new ArgumentExpressionReader(arguments);


            calcService = new CalcService(new MathOptions(arguments.ShouldDenyNegative, arguments.LargestNumber, arguments.MaximumNumbers));

            MathExpressionResult mathExpression = null;

            if (argumentExpression.HasArgumentExpression())
            {
                mathExpression = argumentExpression.Get();
            }
            else
            {
                mathExpression = GetExpressionFromConsole();
            }

            var result = calcService.RunExpression(mathExpression.Op, mathExpression.Expression);

            WriteResult(mathExpression, result);
        }