示例#1
0
        public void Evaluate_NumberOperand_ReturnsNumber()
        {
            var operand    = new Number(1.5);
            var expression = new Plus(operand);

            var result = expression.EvaluateWithData();

            Assert.AreEqual(1.5, result);
        }
示例#2
0
        public void Evaluate_IntegerOperand_ReturnsInteger()
        {
            var operand    = new Integer(3);
            var expression = new Plus(operand);

            var result = expression.EvaluateWithData();

            Assert.AreEqual(3, result);
        }
示例#3
0
        public void Evaluate_BooleanOperand_ThrowsInvalidOperationException()
        {
            var operand    = new Text("Not a Number");
            var expression = new Plus(operand);

            Assert.Throws <InvalidOperationException>(() =>
            {
                expression.EvaluateWithData();
            });
        }