Ejemplo n.º 1
0
        public void Operate_OrOperationOnBooleanValues_BooleanResults()
        {
            DefaultOperationHandler handler = GetOperationHandlerInstance();

            Assert.AreEqual(true, handler.Operate("||", true, false));
            Assert.AreEqual(true, handler.Operate("||", false, true));
            Assert.AreEqual(true, handler.Operate("||", true, true));
            Assert.AreEqual(false, handler.Operate("||", false, false));
        }
Ejemplo n.º 2
0
        public void Operate_ArithmeticOperatorsWithStringOperands_Results()
        {
            DefaultOperationHandler handler = GetOperationHandlerInstance();

            Assert.AreEqual(13d, handler.Operate("+", "5", "8"));
            Assert.AreEqual(-3d, handler.Operate("-", "5", "8"));
            Assert.AreEqual(40d, handler.Operate("*", "5", "8"));
            Assert.AreEqual(0.625d, handler.Operate("/", "5", "8"));
        }
Ejemplo n.º 3
0
        public void Operate_ComparisonOperators_BooleanResults()
        {
            DefaultOperationHandler handler = GetOperationHandlerInstance();

            Assert.AreEqual(false, handler.Operate(">", 5, 8));
            Assert.AreEqual(true, handler.Operate("<", 5, 8));
            Assert.AreEqual(false, handler.Operate(">=", 5, 8));
            Assert.AreEqual(true, handler.Operate("<=", 5, 8));
            Assert.AreEqual(false, handler.Operate("==", 5, 8));
            Assert.AreEqual(true, handler.Operate("==", 5, 5));
            Assert.AreEqual(true, handler.Operate(">=", 5, 5));
            Assert.AreEqual(true, handler.Operate("<=", 5, 5));
        }