public void ShouldThrowIfInvalidFuncNumber() { var func = new Subtotal(); var args = FunctionsHelper.CreateArgs(139, 1); func.Execute(args, _context); }
public void ShouldCalculateMaxWhenCalcTypeIs4() { var func = new Subtotal(); var args = FunctionsHelper.CreateArgs(4, 10, 20, 30, 40, 50); var result = func.Execute(args, _context); Assert.AreEqual(50d, result.Result); }
public void ShouldCalculateStdevPWhenCalcTypeIs108() { var func = new Subtotal(); var args = FunctionsHelper.CreateArgs(108, 10, 20, 30, 40, 50); var result = func.Execute(args, _context); var resultRounded = Math.Round((double)result.Result, 8); Assert.AreEqual(14.14213562, resultRounded); }
public void ShouldCalculateStdevWhenCalcTypeIs7() { var func = new Subtotal(); var args = FunctionsHelper.CreateArgs(7, 10, 20, 30, 40, 50); var result = func.Execute(args, _context); var resultRounded = Math.Round((double)result.Result, 5); Assert.AreEqual(15.81139d, resultRounded); }
public void SubtotalWithInvalidArgumentReturnsPoundValue() { var func = new Subtotal(); var parsingContext = ParsingContext.Create(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, parsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void ShouldCalculateVarWhenCalcTypeIs110() { var func = new Subtotal(); var args = FunctionsHelper.CreateArgs(110, 10, 20, 30, 40, 50, 51); args.Last().SetExcelStateFlag(ExcelCellState.HiddenCell); var result = func.Execute(args, _context); Assert.AreEqual(250d, result.Result); }