예제 #1
0
        public void MergeWithNextWithPlusOperatorShouldSetNextPointer()
        {
            var exp1 = new IntegerExpression("1");
            exp1.Operator = Operator.Plus;
            var exp2 = new IntegerExpression("2");
            exp1.Next = exp2;

            var result = exp1.MergeWithNext();

            Assert.IsNull(result.Next);
        }
예제 #2
0
        public void MergeWithNextWithPlusOperatorShouldCalulateSumCorrectly()
        {
            var exp1 = new IntegerExpression("1");
            exp1.Operator = Operator.Plus;
            var exp2 = new IntegerExpression("2");
            exp1.Next = exp2;

            var result = exp1.MergeWithNext();

            Assert.AreEqual(3d, result.Compile().Result);
        }