Esempio n. 1
0
        public void ShouldThrowIfInvalidFuncNumber()
        {
            var func = new Subtotal();
            var args = FunctionsHelper.CreateArgs(139, 1);

            func.Execute(args, _context);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }