public void BaseCalc_12()
        {
            //arrange
            string data     = MakeString(10);
            double expected = ExpectedResult(data, 10);
            //acts
            double actual = mc.Calculate(data);

            //assert
            Assert.AreEqual(expected, actual);
        }
        static void Main(string[] args)
        {
            while (true)
            {
                string str = null;
                str = Console.ReadLine();
                if (str.Length > 50)
                {
                    Console.WriteLine("Ошибка введено более 50 символов");
                }
                else
                {
                    var         math       = new MathCore();
                    IExpression expression = new MxparserExpression(str);

                    if (math.CheckExpression(expression))
                    {
                        Console.WriteLine("Error");
                        return;
                    }

                    var result = math.Calculate(expression);
                    Console.WriteLine(result);
                }
            }
        }
Ejemplo n.º 3
0
        public void MultiplicationDivisionCalc_7()
        {
            //arrange
            string data     = MakeString(10);
            double expected = ExpectedResult(data, 10);
            //acts
            double actual = mc.Calculate(data);

            //assert
            Assert.AreEqual(expected, actual);
        }
        public void CalcBrackets_1()
        {
            //arrange
            string data     = "2*(1+2)";
            double expected = 6;
            //acts
            double actual = mc.Calculate(data);

            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
 public void BaseCalc_5()
 {
     //arrange
     string data = "Где выражение?";
     //acts
     double actual = mc.Calculate(data);
 }
Ejemplo n.º 6
0
        public void BaseCalc_1()
        {
            //arrange
            string data     = "1+2";
            double expected = 3;
            //acts
            double actual = mc.Calculate(data);

            //assert
            Assert.AreEqual(expected, actual);
        }