Exemplo n.º 1
0
        private void Confirm(FormulaEvaluator fe, Cell cell, String formula,
                             double expectedResult)
        {
            fe.ClearAllCachedResultValues();
            cell.CellFormula = formula;
            CellValue cv = fe.Evaluate(cell);

            if (cv.CellType != CellType.NUMERIC)
            {
                throw new AssertFailedException("expected numeric cell type but got " + cv.FormatAsString());
            }
            Assert.AreEqual(expectedResult, cv.NumberValue, 0.0);
        }
Exemplo n.º 2
0
        private void Confirm(FormulaEvaluator fe, Cell cell, String formula,
                             ErrorEval expectedResult)
        {
            fe.ClearAllCachedResultValues();
            cell.CellFormula = formula;
            CellValue cv = fe.Evaluate(cell);

            if (cv.CellType != CellType.ERROR)
            {
                throw new AssertFailedException("expected error cell type but got " + cv.FormatAsString());
            }
            int expCode = expectedResult.ErrorCode;

            if (cv.ErrorValue != expCode)
            {
                throw new AssertFailedException("Expected error '" + ErrorEval.GetText(expCode)
                                                + "' but got '" + cv.FormatAsString() + "'.");
            }
        }