Пример #1
0
        public void Evaluate_NumberOperand_ReturnsNumber()
        {
            var operand    = new Number(1.5);
            var expression = new Minus(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 Minus(operand);

            var result = expression.EvaluateWithData();

            Assert.AreEqual(-3, result);
        }
Пример #3
0
        public void Evaluate_NullOperand_ThrowsInvalidOperationException()
        {
            var operand    = Null.Instance;
            var expression = new Minus(operand);

            Assert.Throws <InvalidOperationException>(() =>
            {
                expression.EvaluateWithData();
            });
        }
Пример #4
0
        public void Evaluate_BooleanOperand_ThrowsInvalidOperationException()
        {
            var operand    = new Text("Not a Number");
            var expression = new Minus(operand);

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