public void MedianWithNumericStringInputReturnsCorrectValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs("16", "55", "19", "20"), this.ParsingContext); Assert.AreEqual(19.5d, result.Result); }
public void MedianShouldThrowIfNoArgs() { var func = new Median(); var args = FunctionsHelper.Empty(); func.Execute(args, _parsingContext); }
public void MedianWithNumericInputsReturnsCorrectValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs(16, 55, 19, 20), this.ParsingContext); Assert.AreEqual(19.5d, result.Result); }
public void MedianWithGenericStringInputReturnsPoundValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs("string", "string", "string"), this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void MedianWithOneInputReturnsCorrectValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs(15), this.ParsingContext); Assert.AreEqual(15d, result.Result); }
public void MedianWithDoubleInputsReturnsCorrectValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs(5.5, 2.3, 15.6, 11.2), this.ParsingContext); Assert.AreEqual(8.35d, result.Result); }
public void MedianWithLogicInputsReturnsCorrectValue() { var function = new Median(); var result = function.Execute(FunctionsHelper.CreateArgs(true, false), this.ParsingContext); Assert.AreEqual(0.5d, result.Result); }
public void MedianShouldCalculateCorrectlyWithEvenMembers() { var func = new Median(); var args = FunctionsHelper.CreateArgs(1, 2, 3, 4); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2.5d, result.Result); }
public void MedianShouldCalculateCorrectlyWithOddMembers() { var function = new Median(); var arguments = FunctionsHelper.CreateArgs(3, 5, 1, 4, 2); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(3d, result.Result); }
public void MedianShouldPoundNumIfNoArgs() { var function = new Median(); var arguments = new FunctionArgument[] { new FunctionArgument(null) }; var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(OfficeOpenXml.FormulaParsing.ExpressionGraph.DataType.ExcelError, result.DataType); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)(result.Result)).Type); }