public void VarPIsGivenStringNumbersAsInputs() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs("5", "6", "7"), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs("5.5", "6.6", "7.7"), this.ParsingContext); Assert.AreEqual(0.666666667, result1.ResultNumeric, .00001); Assert.AreEqual(0.806666667, result2.ResultNumeric, .00001); }
public void VarPIsGivenAMixedStringInputWithAEmptyCellInTheMiddle() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs(10, 2, "6/17/2011 2:00", "02:00 am"), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(10, 2, "6/17/2011 2:00", null, "02:00 am"), this.ParsingContext); Assert.AreEqual(310699583.6, result1.ResultNumeric, .1); Assert.AreEqual(265143429.9, result2.ResultNumeric, .1); }
public void VarPIsGivenAStringInputWithAEmptyCellInTheMiddle() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs(66, 52, 77, 71, 30, 90, 26, 56, 7), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(66, 52, 77, 71, null, 30, 90, 26, 56, 7), this.ParsingContext); Assert.AreEqual(646.8395062, result1.ResultNumeric, .00001); Assert.AreEqual(832.85, result2.ResultNumeric, .00001); }
public void VarPIsGivenAMixOfInputTypes() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs(1, true, null, "6/17/2011 2:00", "02:00 am"), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(1, true, "6/17/2011 2:00", "02:00 am"), this.ParsingContext); Assert.AreEqual(265175984, result1.ResultNumeric, .1); Assert.AreEqual(310750455.8, result2.ResultNumeric, .1); }
public void VarPIsGivenBooleanInputs() { var function = new VarP(); var boolInputTrue = true; var boolInputFalse = false; var result1 = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputTrue, boolInputFalse), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputTrue, boolInputTrue), this.ParsingContext); var result3 = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputFalse, boolInputFalse), this.ParsingContext); Assert.AreEqual(0.222222222, result1.ResultNumeric, .00001); Assert.AreEqual(0, result2.ResultNumeric, .00001); Assert.AreEqual(0.222222222, result3.ResultNumeric, .00001); }
public void VarPIsGivenADateSeperatedByABackslash() { var function = new VarP(); var input1 = "1/17/2011 2:00"; var input2 = "6/17/2011 2:00"; var input3 = "1/17/2012 2:00"; var input4 = "1/17/2013 2:00"; var result1 = function.Execute(FunctionsHelper.CreateArgs(input1, input1, input1), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(input1, input2, input1), this.ParsingContext); var result3 = function.Execute(FunctionsHelper.CreateArgs(input1, input3, input4), this.ParsingContext); Assert.AreEqual(0, result1.ResultNumeric, .00001); Assert.AreEqual(5066.888889, result2.ResultNumeric, .00001); Assert.AreEqual(89060.22222, result3.ResultNumeric, .00001); }
public void VarPIsGivenASingleStringInput() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs("string"), this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type); }
public void VarPIsGivenASingleFalseBooleanInput() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs(false), this.ParsingContext); Assert.AreEqual(0, result1.ResultNumeric, .00001);; }
public void VarPIsGivenDateTimeInputsSeperatedByADashAsInputs() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs("1-17-2017 2:00", "6-17-2017 2:00", "9-17-2017 2:00"), this.ParsingContext); Assert.AreEqual(10034.88889, result1.ResultNumeric, .00001); }
public void VarPIsGivenMonthDayYear12HourTimeAsInputs() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs("Jan 17, 2011 2:00 am", "June 5, 2017 11:00 pm", "June 15, 2017 11:00 pm"), this.ParsingContext); Assert.AreEqual(1213568.837, result1.ResultNumeric, .001); }
public void VarPIsGiven12HourTimesAsInputs() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs("12:00 am", "02:00 am", "01:00 pm"), this.ParsingContext); Assert.AreEqual(0.056712963, result1.ResultNumeric, .00001); }
public void VarPIsGivenNumbersAsInputstakeTwo() { var function = new VarP(); var result1 = function.Execute(FunctionsHelper.CreateArgs(-1, -1, -1), this.ParsingContext); Assert.AreEqual(0, result1.ResultNumeric, .00001); }
public void VarPIsGivenMaxAmountOfInputs254() { var function = new VarP(); var input1 = 1; var result1 = function.Execute(FunctionsHelper.CreateArgs( 100, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1 ), this.ParsingContext); Assert.AreEqual(38.43469837, result1.ResultNumeric, .00001); }
public void VarPShouldReturnCorrectResult() { var func = new VarP(); var args = FunctionsHelper.CreateArgs(1, 2, 3, 4); var result = func.Execute(args, _parsingContext); Assert.AreEqual(1.25d, result.Result); }
public void VarPShouldIgnoreHiddenValuesIfIgnoreHiddenIsTrue() { var func = new VarP(); func.IgnoreHiddenValues = true; var args = FunctionsHelper.CreateArgs(1, 2, 3, 4, 9); args.Last().SetExcelStateFlag(ExcelCellState.HiddenCell); var result = func.Execute(args, _parsingContext); Assert.AreEqual(1.25d, result.Result); }