Exemplo n.º 1
0
        public void LargeWithNumericStringInputReturnsPoundNum()
        {
            var function = new Large();
            var result   = function.Execute(FunctionsHelper.CreateArgs("3", "56"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Exemplo n.º 2
0
        public void LargeWithDatesAsStringsInputsReturnsPoundNum()
        {
            var function = new Large();
            var result   = function.Execute(FunctionsHelper.CreateArgs("5/15/2017", 6), this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Exemplo n.º 3
0
        public void LargeWithNoInputsReturnsPoundValue()
        {
            var function = new Large();
            var result   = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Exemplo n.º 4
0
        public void LargeShouldReturnTheSecondLargestNumberIf2()
        {
            var func   = new Large();
            var args   = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 2);
            var result = func.Execute(args, _parsingContext);

            Assert.AreEqual(3d, result.Result);
        }
Exemplo n.º 5
0
        public void LargeWithInvalidArgumentReturnsPoundValue()
        {
            var func   = new Large();
            var args   = FunctionsHelper.CreateArgs();
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Exemplo n.º 6
0
        public void LargeShouldReturnTheLargestNumberIf1()
        {
            var func   = new Large();
            var args   = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(1, 2, 3), 1);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(3, result.Result);
        }
Exemplo n.º 7
0
        public void LargeShouldPoundNumIfIndexOutOfBounds()
        {
            var func   = new Large();
            var args   = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 6);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(OfficeOpenXml.FormulaParsing.ExpressionGraph.DataType.ExcelError, result.DataType);
            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)(result.Result)).Type);
        }
Exemplo n.º 8
0
        public void LargeWithNullSecondParameterReturnsPoundNum()
        {
            var function = new Large();
            var result   = function.Execute(FunctionsHelper.CreateArgs(4, null), this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);


            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Formula = "LARGE(4, )";
                worksheet.Calculate();
                Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)worksheet.Cells["B1"].Value).Type);
            }
        }
Exemplo n.º 9
0
 public void LargeShouldThrowIfIndexOutOfBounds()
 {
     var func   = new Large();
     var args   = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 6);
     var result = func.Execute(args, _parsingContext);
 }