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"); }
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); }
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); }
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); }
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); }
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)); }