Example #1
0
        public void RoundupWithBooleanArgumentsReturnCorrectValues()
        {
            var function     = new Roundup();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(2.35, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(2.56, false), this.ParsingContext);

            Assert.AreEqual(2.4d, booleanTrue.Result);
            Assert.AreEqual(3d, booleanFalse.Result);
        }
Example #2
0
        public void RoundupWithSecondInputAsNumericStringReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(25.364, "2"), this.ParsingContext);

            Assert.AreEqual(25.37d, result.Result);
        }
Example #3
0
        public void RoundupWithSecondInputAsZeroReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(12.568, 0), this.ParsingContext);

            Assert.AreEqual(13d, result.Result);
        }
Example #4
0
        public void RoundupWithSecondInputLessThanZeroReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(114512, -3), this.ParsingContext);

            Assert.AreEqual(115000d, result.Result);
        }
Example #5
0
        public void RoundupWithNoArgsReturnsPoundValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #6
0
        public void RoundupWithNegativeIntegerAndNegativeSecondInputReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-45, -2), this.ParsingContext);

            Assert.AreEqual(-100d, result.Result);
        }
Example #7
0
        public void RoundupWithNumberAsDateAsStringReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs("5/5/2017", 2), this.ParsingContext);

            Assert.AreEqual(42860d, result.Result);
        }
Example #8
0
        public void RoundupWithNumbericStringReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs("23.25623665", 3), this.ParsingContext);

            Assert.AreEqual(23.257d, result.Result);
        }
Example #9
0
        public void RoundupWithDoubleAndPositiveSecondInputReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(25.364, 2), this.ParsingContext);

            Assert.AreEqual(25.37d, result.Result);
        }
Example #10
0
        public void RoundupWithSecondInputAsDateAsStringReturnsCorrectValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(12.3546, "5/5/2017"), this.ParsingContext);

            Assert.AreEqual(12.3546d, result.Result);
        }
Example #11
0
        public void RoundupWithSecondInputAsGeneralStringReturnsPoundValue()
        {
            var function = new Roundup();
            var result   = function.Execute(FunctionsHelper.CreateArgs(45.6, "string"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #12
0
        public void RoundupShouldHandleNegativeNumDigits()
        {
            var func   = new Roundup();
            var args   = FunctionsHelper.CreateArgs(99123, -2);
            var result = func.Execute(args, _parsingContext);

            Assert.AreEqual(99200d, result.Result);
        }
Example #13
0
        public void RoundupShouldReturnCorrectResultWithPositiveNumber()
        {
            var func   = new Roundup();
            var args   = FunctionsHelper.CreateArgs(9.9911, 3);
            var result = func.Execute(args, _parsingContext);

            Assert.AreEqual(9.992, result.Result);
        }
Example #14
0
        public void RoundupShouldHandleZeroNumDigits()
        {
            var func   = new Roundup();
            var args   = FunctionsHelper.CreateArgs(999.999, 0);
            var result = func.Execute(args, _parsingContext);

            Assert.AreEqual(1000d, result.Result);
        }