Beispiel #1
0
        public void WhenEvalIsCalledOnAnUnitializedOpNode_ShouldThrowInvalidOperationException()
        {
            // Arrange
            OpNode testOpNode = new OpNode();

            // Act
            testOpNode.Eval();

            // Assert is handled by the ExpectedException attribute on the test method.
        }
Beispiel #2
0
        public void EvalMultiplyTest()
        {
            // Arrange
            double  testLeftValue  = 11.3214;
            double  testRightValue = 3485;
            ExpNode testLeftNode   = new ValNode(testLeftValue);
            ExpNode testRightNode  = new ValNode(testRightValue);

            OpNode testOpNode = new OpNode(ref testLeftNode, ref testRightNode, '*');

            // Act and Assert
            Assert.AreEqual((testLeftValue * testRightValue), testOpNode.Eval());
        }