Example #1
0
        public void RoundDownWithBooleanSecondInputReturnsCorrectValue()
        {
            var function     = new Rounddown();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(12.345, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(12.345, false), this.ParsingContext);

            Assert.AreEqual(12.3d, booleanTrue.Result);
            Assert.AreEqual(12d, booleanFalse.Result);
        }
Example #2
0
        public void RoundDownWithNegativeSecondInputReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(9333.23, -3), this.ParsingContext);

            Assert.AreEqual(9000d, result.Result);
        }
Example #3
0
        public void RoundDownWithPositiveSecondInputReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(12.356, 1), this.ParsingContext);

            Assert.AreEqual(12.3d, result.Result);
        }
Example #4
0
        public void RoundDownWithNoInputsReturnsPoundValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #5
0
        public void RoundDownWithSecondArgumentAsDateAsStringReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(52.3, "5/5/2017"), this.ParsingContext);

            Assert.AreEqual(52.3d, result.Result);
        }
Example #6
0
        public void RoundDownWithNegativeDoublePositiveSecondArgReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-5.326571, 3), this.ParsingContext);

            Assert.AreEqual(-5.326d, result.Result);
        }
Example #7
0
        public void RoundDownWithNegativeIntegerNegativeSecondArgReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-98, -2), this.ParsingContext);

            Assert.AreEqual(0d, result.Result);
        }
Example #8
0
        public void RoundDownWithFirstInputAsDateAsStringReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs("5/5/2017", 2), this.ParsingContext);

            Assert.AreEqual(42860d, result.Result);
        }
Example #9
0
        public void RoundDownWithGeneralStringFirstInputReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs("string", 3), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #10
0
        public void RoundDownWithNumericStringFirstInputReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs("45546.546444", 3), this.ParsingContext);

            Assert.AreEqual(45546.546d, result.Result);
        }
Example #11
0
        public void RoundDownWithZeroSecondInputReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(58.999999, 0), this.ParsingContext);

            Assert.AreEqual(58d, result.Result);
        }
Example #12
0
        public void RoundDownWithNumericStringSecondArgumentReturnsCorrectValue()
        {
            var function = new Rounddown();
            var result   = function.Execute(FunctionsHelper.CreateArgs(15.351, "2"), this.ParsingContext);

            Assert.AreEqual(15.35, result.Result);
        }
Example #13
0
        public void RounddownShouldHandleZeroNumDigits()
        {
            var func   = new Rounddown();
            var args   = FunctionsHelper.CreateArgs(999.999, 0);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(999d, result.Result);
        }
Example #14
0
        public void RounddownShouldReturn0IfNegativeNumDigitsIsTooLarge()
        {
            var func   = new Rounddown();
            var args   = FunctionsHelper.CreateArgs(999.999, -4);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(0d, result.Result);
        }
Example #15
0
        public void RounddownShouldHandleNegativeNumber()
        {
            var func   = new Rounddown();
            var args   = FunctionsHelper.CreateArgs(-9.999, 2);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(-9.99, result.Result);
        }
Example #16
0
        public void RounddownShouldReturnCorrectResultWithPositiveNumber()
        {
            var func   = new Rounddown();
            var args   = FunctionsHelper.CreateArgs(9.999, 2);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(9.99, result.Result);
        }
Example #17
0
        public void RounddownShouldHandleNegativeNumDigits()
        {
            var func   = new Rounddown();
            var args   = FunctionsHelper.CreateArgs(999.999, -2);
            var result = func.Execute(args, _parsingContext);

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