Ejemplo n.º 1
0
        public void MinusOperation_Test()
        {
            MinusOperation op = new MinusOperation(new Integer(2), new Integer(4));

            Assert.AreEqual(-2, op.Value);
            Assert.AreEqual("2 - 4", op.ToString());
        }
Ejemplo n.º 2
0
        public void Equation_Test1()
        {
            //Try to represent the equation ((5+1) x 3) - 4
            IEquation node1 = new AddOperation(new Integer(5), new Integer(1));

            Assert.AreEqual(6, node1.Value);

            MultiplyOperation node2 = new MultiplyOperation(node1, new Integer(3));

            Assert.AreEqual(18, node2.Value);

            MinusOperation equation = new MinusOperation(node2, new Integer(4));

            Assert.AreEqual(14, equation.Value);
            Assert.AreEqual("((5 + 1) x 3) - 4", equation.ToString());
        }