示例#1
0
        public void testInvalidInput2()
        {
            Calculator.Request req = new Calculator.Request();
            bool valid             = req.setValue("4 x 0 +");

            Assert.AreEqual(false, valid);
        }
示例#2
0
        public void testTime()
        {
            Calculator.Request req = new Calculator.Request();
            req.setValue("4 * 5");
            double ans = req.getResult();

            Assert.AreEqual(20, ans);
        }
示例#3
0
        public void testDivide1()
        {
            Calculator.Request req = new Calculator.Request();
            req.setValue("4 / 5");
            double ans = req.getResult();

            Assert.AreEqual(0.8, ans);
        }
示例#4
0
        public void testMinus()
        {
            Calculator.Request req = new Calculator.Request();
            req.setValue("4 - 5");
            double ans = req.getResult();

            Assert.AreEqual(-1, ans);
        }
示例#5
0
        public void testInvalidInput3()
        {
            Calculator.Request req = new Calculator.Request();
            req.setValue("4 x +");
            double ans   = req.getResult();
            bool   valid = req.getValid();

            Assert.AreEqual(0, ans);
            Assert.AreEqual(false, valid);
        }