public void TestMultiplication() { BinaryOperator multiplicationExpression = new MultiplicationOperator(); multiplicationExpression.SetFirstOperand(new Value(1.1M)); multiplicationExpression.SetSecondOperand(new Value(2M)); Assert.AreEqual(2.2M, multiplicationExpression.Evaluate()); }
public void TestPrintMultiplicationExpression() { BinaryOperator multiplicationOperation = new MultiplicationOperator(); multiplicationOperation.SetFirstOperand(new Value(2.9M)); multiplicationOperation.SetSecondOperand(new Value(3)); Assert.AreEqual("2.9 × 3".Replace(" ", ""), multiplicationOperation.ToString().Replace(" ", "")); }