Exemple #1
0
        public void TestCombination4()
        {
            string         input    = "9 / 3 + 6 - 1 X 0";
            OperationLogic logic    = new OperationLogic();
            string         expected = "9";

            string actual = logic.PerformOperation(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void TestCombination3()
        {
            string         input    = "9 + 3 X 2 - 3 / 6";
            OperationLogic logic    = new OperationLogic();
            string         expected = "14.5";

            string actual = logic.PerformOperation(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void TestDivision()
        {
            string         input    = "9 / 3";
            OperationLogic logic    = new OperationLogic();
            string         expected = "3";

            string actual = logic.PerformOperation(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void TestMultiplication()
        {
            string         input    = "5 X 3";
            OperationLogic logic    = new OperationLogic();
            string         expected = "15";

            string actual = logic.PerformOperation(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void TestCombination5()
        {
            string         input    = "0 / 4 + 1564 - 74 + 10 / 5";
            OperationLogic logic    = new OperationLogic();
            string         expected = "1492";

            string actual = logic.PerformOperation(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #6
0
        private void buttonEqual_Click(object sender, EventArgs e)
        {
            if (brackets != null)
            {
                if (brackets.Count >= 1 && bracketsused)
                {
                    return;
                }
            }
            Console.WriteLine("Will do calculation");
            OperationLogic op   = new OperationLogic();
            String         text = Screen.Text;

            Screen.Text = String.Empty;
            Screen.Text = op.PerformOperation(text) + "";
            //isPressed = true;
            //buttonDot.Enabled = false;
        }