Esempio n. 1
0
        public void CheckCurrencyTest7()
        {
            AnalaizerClass.expression = "9+(34-65*(4/)2)";
            bool expected = true;
            bool actual   = AnalaizerClass.CheckCurrency();

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        private void CheckCurrencyTest(int testNumber, string input, bool expected)
        {
            AnalaizerClass.expression = input;
            bool result = AnalaizerClass.CheckCurrency();

            Log.CreateLog(logger, component, testNumber, input, expected.ToString(), result.ToString());
            Assert.AreEqual(result, expected);
        }
Esempio n. 3
0
        public void CheckCurrencyTest3()
        {
            AnalaizerClass.expression = "((2+2)*3";
            bool expected = false;
            bool actual   = AnalaizerClass.CheckCurrency();

            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void CheckCurrencyTest1()
        {
            AnalaizerClass.expression = "3*(2+2)";
            bool expected = true;
            bool actual   = AnalaizerClass.CheckCurrency();

            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        private static void AnalaizerTest1()
        {
            try
            {
                Console.WriteLine("Test 1");
                AnalaizerClass.expression = "(1+(1+(1+(1+(1+1)))))";
                Console.WriteLine("Input data: " + AnalaizerClass.expression);
                Console.WriteLine("Expected result: true");
                bool result = AnalaizerClass.CheckCurrency();
                Console.WriteLine("Result: " + result);
                if (result)
                {
                    Console.WriteLine("Test complete");
                }
                else
                {
                    Console.WriteLine("Test failed");
                }
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Test failed");
            }

            try
            {
                Console.WriteLine("Test 2");
                AnalaizerClass.expression = "(1+(1+(1+(1+(1+1)))";
                Console.WriteLine("Input data:" + AnalaizerClass.expression);
                Console.WriteLine("Expected result: false");
                bool result = AnalaizerClass.CheckCurrency();
                Console.WriteLine("Result: " + result);
                if (!result)
                {
                    Console.WriteLine("Test complete");
                }
                else
                {
                    Console.WriteLine("Test failed");
                }
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Test failed");
            }
        }
Esempio n. 6
0
        private void CheckCurrencyTest(int testNumber, string input, bool expected)
        {
            AnalaizerClass.expression = input;
            bool result = AnalaizerClass.CheckCurrency();

            if (result == expected)
            {
                Log.CreateLogInfo(logger, testNumber, input, expected.ToString(), result.ToString());
            }
            else
            {
                Log.CreateBugReport(logger, COMPONENT_NAME, testNumber, input, expected.ToString(), result.ToString());
            }
            Assert.AreEqual(expected, result);
        }
Esempio n. 7
0
 static void CheckCurrencyTest() //Проверка корректности скобочной структуры входного выражения
 {
     for (int i = 0; i < 3; i++)
     {
         Console.WriteLine("CheckCurrency()");
         AnalaizerClass.expression = Console.ReadLine();
         bool result = AnalaizerClass.CheckCurrency();
         if (result)
         {
             Console.WriteLine("Скобочная структура верна");
         }
         else
         {
             Console.WriteLine("Скобочная структура неверна");
         }
     }
 }