private static void ConfirmExpectedResult(String msg, Cell expected, CellValue actual) { if (expected == null) { throw new AssertionFailedError(msg + " - Bad Setup data expected value is null"); } if(actual == null) { throw new AssertionFailedError(msg + " - actual value was null"); } switch (expected.GetCellType()) { case Cell.CELL_TYPE_BLANK: Assert.AreEqual(msg, Cell.CELL_TYPE_BLANK, actual.GetCellType()); break; case Cell.CELL_TYPE_BOOLEAN: Assert.AreEqual(msg, Cell.CELL_TYPE_BOOLEAN, actual.GetCellType()); Assert.AreEqual(msg, expected.GetBooleanCellValue(), actual.GetBooleanValue()); break; case Cell.CELL_TYPE_ERROR: Assert.AreEqual(msg, Cell.CELL_TYPE_ERROR, actual.GetCellType()); if(false) { // TODO: fix ~45 functions which are currently returning incorrect error values Assert.AreEqual(msg, expected.GetErrorCellValue(), actual.GetErrorValue()); } break; case Cell.CELL_TYPE_FORMULA: // will never be used, since we will call method After formula Evaluation throw new AssertionFailedError("Cannot expect formula as result of formula Evaluation: " + msg); case Cell.CELL_TYPE_NUMERIC: Assert.AreEqual(msg, Cell.CELL_TYPE_NUMERIC, actual.GetCellType()); TestMathX.Assert.AreEqual(msg, expected.GetNumericCellValue(), actual.GetNumberValue(), TestMathX.POS_ZERO, TestMathX.DIFF_TOLERANCE_FACTOR); // double delta = Math.abs(expected.GetNumericCellValue()-actual.GetNumberValue()); // double pctExpected = Math.abs(0.00001*expected.GetNumericCellValue()); // Assert.IsTrue(msg, delta <= pctExpected); break; case Cell.CELL_TYPE_STRING: Assert.AreEqual(msg, Cell.CELL_TYPE_STRING, actual.GetCellType()); Assert.AreEqual(msg, expected.GetRichStringCellValue().GetString(), actual.StringValue); break; } }