public void Text_Empty_Input_String() { Object actual = XLWorkbook.EvaluateExpr(@"Text(1913415.93, """")"); Assert.AreEqual("", actual); }
public void EOMonth_Negative() { Object actual = XLWorkbook.EvaluateExpr("EOMonth(\"3/1/2008\", -1)"); Assert.AreEqual(new DateTime(2008, 2, 29), actual); }
public void Hour() { Object actual = XLWorkbook.EvaluateExpr("Hour(\"8/22/2008 3:30:45 PM\")"); Assert.AreEqual(15, actual); }
public void Decimal(string inputString, int radix, int expectedResult) { var actualResult = XLWorkbook.EvaluateExpr($"DECIMAL(\"{inputString}\", {radix})"); Assert.AreEqual(expectedResult, actualResult); }
public void Days360_US2() { Object actual = XLWorkbook.EvaluateExpr("DAYS360(\"3/31/2008\", \"1/1/2008\",FALSE)"); Assert.AreEqual(-89, actual); }
public void Csch_ReturnsDivisionByZeroErrorOnInput0() { Assert.Throws <DivisionByZeroException>(() => XLWorkbook.EvaluateExpr("CSCH(0)")); }
public void Cot(double input, double expected) { var actual = (double)XLWorkbook.EvaluateExpr(string.Format(@"COT({0})", input.ToString(CultureInfo.InvariantCulture))); Assert.AreEqual(expected, actual, tolerance * 10.0); }
public void Value_Input_String_Is_Not_A_Number() { Assert.That(() => XLWorkbook.EvaluateExpr(@"Value(""asdf"")"), Throws.Exception); }
public void Code_Empty_Input_String() { // Todo: more specific exception - ValueException? Assert.That(() => XLWorkbook.EvaluateExpr(@"Code("""")"), Throws.Exception); }
public void Upper_Empty_Input_String() { Object actual = XLWorkbook.EvaluateExpr(@"Upper("""")"); Assert.AreEqual("", actual); }
public void Upper_Value() { Object actual = XLWorkbook.EvaluateExpr(@"Upper(""AbCdEfG"")"); Assert.AreEqual("ABCDEFG", actual); }
public void Trim_Value() { Object actual = XLWorkbook.EvaluateExpr(@"Trim("" some text with padding "")"); Assert.AreEqual("some text with padding", actual); }
public void Trim_EmptyInput_Striong() { Object actual = XLWorkbook.EvaluateExpr(@"Trim("""")"); Assert.AreEqual("", actual); }
public void Text_String_Input() { Object actual = XLWorkbook.EvaluateExpr(@"TEXT(""211x"", ""#00"")"); Assert.AreEqual("211x", actual); }
public void Combina_CalculatesCorrectValues(int number, int chosen, int expectedResult) { var actualResult = XLWorkbook.EvaluateExpr($"COMBINA({number}, {chosen})"); Assert.AreEqual(expectedResult, (long)actualResult); }
public void Dollar_Empty_Input_String() { Assert.That(() => XLWorkbook.EvaluateExpr(@"Dollar("", 3)"), Throws.Exception); }
public void CSch_CalculatesCorrectValues(double input, double expectedOutput) { Assert.AreEqual(expectedOutput, (double)XLWorkbook.EvaluateExpr($@"CSCH({input})"), 0.000000001); }
public void Fact() { object actual = XLWorkbook.EvaluateExpr("Fact(5.9)"); Assert.AreEqual(120.0, actual); }
public void Int(double input, double expected) { var actual = XLWorkbook.EvaluateExpr(string.Format(@"INT({0})", input.ToString(CultureInfo.InvariantCulture))); Assert.AreEqual(expected, actual); }
public void Multinomial() { object actual = XLWorkbook.EvaluateExpr("Multinomial(2,3,4)"); Assert.AreEqual(1260.0, actual); }
public void Cot_Input0() { Assert.Throws <DivisionByZeroException>(() => XLWorkbook.EvaluateExpr("COT(0)")); }
public void Product() { object actual = XLWorkbook.EvaluateExpr("Product(2,3,4)"); Assert.AreEqual(24.0, actual); }
public void Decimal_ZeroIsZeroInAnyRadix([Range(2, 36)] int radix) { Assert.AreEqual(0, XLWorkbook.EvaluateExpr($"DECIMAL(\"0\", {radix})")); }
public void Radians() { object actual = XLWorkbook.EvaluateExpr("Radians(270)"); Assert.IsTrue(Math.Abs(4.71238898038469 - (double)actual) < XLHelper.Epsilon); }
public void EDate_Positive1() { Object actual = XLWorkbook.EvaluateExpr("EDate(\"3/1/2008\", 1)"); Assert.AreEqual(new DateTime(2008, 4, 1), actual); }
public void Degrees() { object actual1 = XLWorkbook.EvaluateExpr("Degrees(180)"); Assert.IsTrue(Math.PI - (double)actual1 < XLHelper.Epsilon); }
public void EOMonth_Positive() { Object actual = XLWorkbook.EvaluateExpr("EOMonth(\"3/31/2008\", 1)"); Assert.AreEqual(new DateTime(2008, 4, 30), actual); }
public void Decimal_ReturnsErrorForRadiansSmaller2([Range(-5, 1)] int radix) { Assert.Throws <NumberException>(() => XLWorkbook.EvaluateExpr($"DECIMAL(\"0\", {radix})")); }
public void Minute() { Object actual = XLWorkbook.EvaluateExpr("Minute(\"8/22/2008 3:30:45 AM\")"); Assert.AreEqual(30, actual); }
public void Search_Start_Position_Too_Large2() { Assert.That(() => XLWorkbook.EvaluateExpr(@"Search(""text"", ""This is some text"", 15)"), Throws.Exception); }