private double DoCalculation()
    {
        switch (calculation)
        {
        case CalculationType.addition:
            addition.leftOperand  = firstNumber.Evaluate();
            addition.rightOperand = secondNumber.Evaluate();
            return(addition.Evaluate());

        case CalculationType.subtraction:
            subtraction.leftOperand  = firstNumber.Evaluate();
            subtraction.rightOperand = secondNumber.Evaluate();
            return(subtraction.Evaluate());

        case CalculationType.multiplication:
            multiplication.leftOperand  = firstNumber.Evaluate();
            multiplication.rightOperand = secondNumber.Evaluate();
            return(multiplication.Evaluate());

        case CalculationType.division:
            division.leftOperand  = firstNumber.Evaluate();
            division.rightOperand = secondNumber.Evaluate();
            return(division.Evaluate());

        default:
            return(0);
        }
    }
        public void EvaluateWithTwoNormalOperands()
        {
            var left = new Expression { Value = 1 };
            var right = new Expression { Value = 2 };

            var expression = new MultiplicationExpression(left, right);
            Assert.AreEqual(2, expression.Evaluate());
        }
        public void EvaluateWithTwoNormalOperands()
        {
            var left  = new ConstantExpression(1);
            var right = new ConstantExpression(2);

            var expression = new MultiplicationExpression(left, right);

            Assert.AreEqual(2, expression.Evaluate());
        }
        public void EvaluateWithOneMultiplicationExpression()
        {
            var left = new Expression { Value = 1 };
            var leftTwo = new Expression { Value = 2 };
            var rightTwo = new Expression { Value = 3 };
            var right = new MultiplicationExpression(leftTwo, rightTwo);

            var expression = new MultiplicationExpression(left, right);
            Assert.AreEqual(6, expression.Evaluate());
        }
        public void EvaluateWithOneMultiplicationExpression()
        {
            var left     = new ConstantExpression(1);
            var leftTwo  = new ConstantExpression(2);
            var rightTwo = new ConstantExpression(3);
            var right    = new MultiplicationExpression(leftTwo, rightTwo);

            var expression = new MultiplicationExpression(left, right);

            Assert.AreEqual(6, expression.Evaluate());
        }