public void SmallWithNumericStringInputReturnsPoundNum() { var function = new Small(); var result = function.Execute(FunctionsHelper.CreateArgs("5", "56"), this.ParsingContext); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type); }
public void SmallWithNoInputsReturnsPoundValue() { var function = new Small(); var result = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void SmallShouldReturnTheSecondSmallestNumberIf2() { var func = new Small(); var args = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 2); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }
public void SmallWithInvalidArgumentReturnsPoundValue() { var func = new Small(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void SmallShouldReturnTheSmallestNumberIf1() { var func = new Small(); var args = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(1, 2, 3), 1); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(1, result.Result); }
public void SmallShouldPoundNumIfIndexOutOfBounds() { var func = new Small(); 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); }
public void SmallWithNullSecondParameterReturnsPoundNum() { var function = new Small(); var result = function.Execute(FunctionsHelper.CreateArgs(5, 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 = "SMALL(5, )"; worksheet.Calculate(); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)worksheet.Cells["B1"].Value).Type); } }
public void SmallShouldThrowIfIndexOutOfBounds() { var func = new Small(); var args = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 6); var result = func.Execute(args, _parsingContext); }