Exemplo n.º 1
0
        public void TestEDateBlankRefValueEval()
        {
            EDate      eDate  = new EDate();
            NumberEval result = (NumberEval)eDate.Evaluate(new ValueEval[] { new RefEvalImplementation(BlankEval.instance), new NumberEval(0) }, null);

            Assert.AreEqual(-1.0d, result.NumberValue, "0 startDate triggers BAD_DATE currently, thus -1.0!");

            result = (NumberEval)eDate.Evaluate(new ValueEval[] { new NumberEval(1), new RefEvalImplementation(BlankEval.instance) }, null);
            Assert.AreEqual(1.0d, result.NumberValue, "Blank is handled as 0 otherwise");
        }
Exemplo n.º 2
0
        public void TestEDateInvalidValues()
        {
            EDate     eDate  = (EDate)EDate.Instance;
            ErrorEval result = (ErrorEval)eDate.Evaluate(new ValueEval[] { new NumberEval(1000) }, null);

            Assert.AreEqual(ErrorConstants.ERROR_VALUE, result.ErrorCode);
        }
Exemplo n.º 3
0
        public void TestEDateProperValues()
        {
            EDate      eDate  = (EDate)EDate.Instance;
            NumberEval result = (NumberEval)eDate.Evaluate(new ValueEval[] { new NumberEval(1000), new NumberEval(0) }, null);

            Assert.AreEqual(1000d, result.NumberValue);
        }
Exemplo n.º 4
0
        public void TestRefEvalStartDate()
        {
            EDate      eDate  = new EDate();
            NumberEval result = (NumberEval)eDate.Evaluate(new ValueEval[] { new RefEvalImplementation(new NumberEval(1000)), new NumberEval(0) }, null);

            Assert.AreEqual(1000d, result.NumberValue);
        }
Exemplo n.º 5
0
        private void checkValue(int startDate, int monthInc, double expectedResult)
        {
            EDate      eDate  = new EDate();
            NumberEval result = (NumberEval)eDate.Evaluate(new ValueEval[] { new NumberEval(startDate), new NumberEval(monthInc) }, null);

            Assert.AreEqual(expectedResult, result.NumberValue);
        }
Exemplo n.º 6
0
        public void TestEDateDecrease()
        {
            EDate      eDate      = (EDate)EDate.Instance;
            DateTime   startDate  = DateTime.Now;
            int        offset     = -2;
            NumberEval result     = (NumberEval)eDate.Evaluate(new ValueEval[] { new NumberEval(DateUtil.GetExcelDate(startDate)), new NumberEval(offset) }, null);
            DateTime   resultDate = DateUtil.GetJavaDate(result.NumberValue);

            Assert.AreEqual(resultDate, startDate.AddMonths(offset));
        }