Beispiel #1
0
        public void TestPrintIncompleteDivide()
        {
            BinaryOperator multiplyOperation = new DivisionOperator();

            multiplyOperation.SetFirstOperand(new Value(1));
            Assert.AreEqual("1 ÷ ".Replace(" ", ""), multiplyOperation.ToString().Replace(" ", ""));
        }
Beispiel #2
0
        public void TestDivision()
        {
            BinaryOperator divisionExpression = new DivisionOperator();

            divisionExpression.SetFirstOperand(new Value(2.2M));
            divisionExpression.SetSecondOperand(new Value(1.1M));
            Assert.AreEqual(2M, divisionExpression.Evaluate());
        }
Beispiel #3
0
        public void TestPrintDivisionExpression()
        {
            BinaryOperator divisionOperation = new DivisionOperator();

            divisionOperation.SetFirstOperand(new Value(2.9M));
            divisionOperation.SetSecondOperand(new Value(3));
            Assert.AreEqual("2.9 ÷ 3".Replace(" ", ""), divisionOperation.ToString().Replace(" ", ""));
        }
Beispiel #4
0
        public void TestOperatorMismatchInequality()
        {
            BinaryOperator addOperation = new AddOperator();

            addOperation.SetFirstOperand((Value)5);
            addOperation.SetSecondOperand((Value)6);

            BinaryOperator divideOperation = new DivisionOperator();

            divideOperation.SetFirstOperand((Value)5);
            divideOperation.SetSecondOperand((Value)6);
            Assert.AreNotEqual(addOperation, divideOperation);
        }