示例#1
0
        public void Text_Empty_Input_String()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"Text(1913415.93, """")");

            Assert.AreEqual("", actual);
        }
示例#2
0
        public void EOMonth_Negative()
        {
            Object actual = XLWorkbook.EvaluateExpr("EOMonth(\"3/1/2008\", -1)");

            Assert.AreEqual(new DateTime(2008, 2, 29), actual);
        }
示例#3
0
        public void Hour()
        {
            Object actual = XLWorkbook.EvaluateExpr("Hour(\"8/22/2008 3:30:45 PM\")");

            Assert.AreEqual(15, actual);
        }
示例#4
0
        public void Decimal(string inputString, int radix, int expectedResult)
        {
            var actualResult = XLWorkbook.EvaluateExpr($"DECIMAL(\"{inputString}\", {radix})");

            Assert.AreEqual(expectedResult, actualResult);
        }
示例#5
0
        public void Days360_US2()
        {
            Object actual = XLWorkbook.EvaluateExpr("DAYS360(\"3/31/2008\", \"1/1/2008\",FALSE)");

            Assert.AreEqual(-89, actual);
        }
示例#6
0
 public void Csch_ReturnsDivisionByZeroErrorOnInput0()
 {
     Assert.Throws <DivisionByZeroException>(() => XLWorkbook.EvaluateExpr("CSCH(0)"));
 }
示例#7
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);
        }
示例#8
0
 public void Value_Input_String_Is_Not_A_Number()
 {
     Assert.That(() => XLWorkbook.EvaluateExpr(@"Value(""asdf"")"), Throws.Exception);
 }
示例#9
0
 public void Code_Empty_Input_String()
 {
     // Todo: more specific exception - ValueException?
     Assert.That(() => XLWorkbook.EvaluateExpr(@"Code("""")"), Throws.Exception);
 }
示例#10
0
        public void Upper_Empty_Input_String()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"Upper("""")");

            Assert.AreEqual("", actual);
        }
示例#11
0
        public void Upper_Value()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"Upper(""AbCdEfG"")");

            Assert.AreEqual("ABCDEFG", actual);
        }
示例#12
0
        public void Trim_Value()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"Trim("" some text with padding   "")");

            Assert.AreEqual("some text with padding", actual);
        }
示例#13
0
        public void Trim_EmptyInput_Striong()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"Trim("""")");

            Assert.AreEqual("", actual);
        }
示例#14
0
        public void Text_String_Input()
        {
            Object actual = XLWorkbook.EvaluateExpr(@"TEXT(""211x"", ""#00"")");

            Assert.AreEqual("211x", actual);
        }
示例#15
0
        public void Combina_CalculatesCorrectValues(int number, int chosen, int expectedResult)
        {
            var actualResult = XLWorkbook.EvaluateExpr($"COMBINA({number}, {chosen})");

            Assert.AreEqual(expectedResult, (long)actualResult);
        }
示例#16
0
 public void Dollar_Empty_Input_String()
 {
     Assert.That(() => XLWorkbook.EvaluateExpr(@"Dollar("", 3)"), Throws.Exception);
 }
示例#17
0
 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);
        }
示例#19
0
        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);
        }
示例#21
0
 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);
        }
示例#23
0
 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);
        }
示例#25
0
        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);
        }
示例#27
0
        public void EOMonth_Positive()
        {
            Object actual = XLWorkbook.EvaluateExpr("EOMonth(\"3/31/2008\", 1)");

            Assert.AreEqual(new DateTime(2008, 4, 30), actual);
        }
示例#28
0
 public void Decimal_ReturnsErrorForRadiansSmaller2([Range(-5, 1)] int radix)
 {
     Assert.Throws <NumberException>(() => XLWorkbook.EvaluateExpr($"DECIMAL(\"0\", {radix})"));
 }
示例#29
0
        public void Minute()
        {
            Object actual = XLWorkbook.EvaluateExpr("Minute(\"8/22/2008 3:30:45 AM\")");

            Assert.AreEqual(30, actual);
        }
示例#30
0
 public void Search_Start_Position_Too_Large2()
 {
     Assert.That(() => XLWorkbook.EvaluateExpr(@"Search(""text"", ""This is some text"", 15)"), Throws.Exception);
 }