Пример #1
0
        public void TryCalculateTest(string exprText, double expect)
        {
            IArithmetricCalculator calculator = ExpressionTreeArithmetricCalculator.Create(exprText);
            bool success = calculator.TryCalculate(out double result);

            Assert.Equal(expect, result);
        }
Пример #2
0
        public void CalculateTest(string exprText, double expect)
        {
            IArithmetricCalculator calculator = ExpressionTreeArithmetricCalculator.Create(exprText);
            double res = calculator.Calculate();

            Assert.Equal(expect, res);
        }
Пример #3
0
        public void CalculateTest_Throws()
        {
            string exprText = "55++6";

            Assert.Throws <InvalidExpressionException>(() => ExpressionTreeArithmetricCalculator.Create(exprText));
        }