public void Equation_Test3() { //Try to represent the equation ((6 / 3) + 2) x 5 IEquation node1 = new DivideOperation(new Integer(6), new Integer(3)); Assert.AreEqual(2, node1.Value); IEquation node2 = new AddOperation(node1, new Integer(2)); Assert.AreEqual(4, node2.Value); IEquation equation = new MultiplyOperation(node2, new Integer(5)); Assert.AreEqual(20, equation.Value); Assert.AreEqual("((6 / 3) + 2) x 5", equation.ToString()); }
public void MultiplyOperation_Test() { MultiplyOperation op = new MultiplyOperation(new Integer(2), new Integer(4)); Assert.AreEqual(8, op.Value); Assert.AreEqual("2 x 4", op.ToString()); }