Ejemplo n.º 1
0
        public void AlterationTest()
        {
            // Create inital combination
            ExpressionHex expression = _expression1.Combine(_expression2, ExpressionOperator.Plus) as ExpressionHex;

            Assert.AreEqual(expression.Result.ToInteger(), 3);

            // Alter combined object
            _expression2 = _expression2.Combine(_expression3, ExpressionOperator.Plus) as ExpressionHex;
            Assert.AreEqual(expression.Result.ToInteger(), 3);
        }
Ejemplo n.º 2
0
        public void MultiplyTest()
        {
            ExpressionHex expression = _expression1.Combine(_expression2, ExpressionOperator.Multiply) as ExpressionHex;

            // 1 * 2
            Assert.AreEqual(expression.Result.ToInteger(), 2);

            expression = expression.Combine(_expression3, ExpressionOperator.Multiply) as ExpressionHex;

            // 1 * 2 * 3
            Assert.AreEqual(expression.Result.ToInteger(), 6);
        }
Ejemplo n.º 3
0
        public void DivideTest()
        {
            ExpressionHex expression = _expression1.Combine(_expression2, ExpressionOperator.Divide) as ExpressionHex;

            // 1 / 2
            Assert.AreEqual(expression.Result.ToInteger(), 0);

            expression = expression.Combine(_expression3, ExpressionOperator.Divide) as ExpressionHex;

            // (1 / 2) / 3
            Assert.AreEqual(expression.Result.ToInteger(), 0);
        }
Ejemplo n.º 4
0
        public void MinusTest()
        {
            ExpressionHex expression = _expression1.Combine(_expression2, ExpressionOperator.Minus) as ExpressionHex;

            // 1 - 2
            Assert.AreEqual(expression.Result.ToInteger(), -1);

            expression = expression.Combine(_expression3, ExpressionOperator.Minus) as ExpressionHex;

            // 1 - 2 - 3
            Assert.AreEqual(expression.Result.ToInteger(), -4);
        }
Ejemplo n.º 5
0
        public void PlusTest()
        {
            ExpressionHex expression = _expression1.Combine(_expression2, ExpressionOperator.Plus) as ExpressionHex;

            // 1 + 2
            Assert.AreEqual(expression.Result.ToInteger(), 3);

            expression = expression.Combine(_expression3, ExpressionOperator.Plus) as ExpressionHex;

            // 1 + 2 + 3
            Assert.AreEqual(expression.Result.ToInteger(), 6);
        }