Пример #1
0
        public void FloorMathWithBooleanNumberInputReturnsZero()
        {
            var function     = new FloorMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(true, 5), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(false, 3), this.ParsingContext);

            Assert.AreEqual(0d, booleanTrue.Result);
            Assert.AreEqual(0d, booleanFalse.Result);
        }
Пример #2
0
        public void FloorMathWithBooleanModeInputReturnsCorrectValue()
        {
            var function     = new FloorMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(-45.7, 3, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(-45.7, 3, false), this.ParsingContext);

            Assert.AreEqual(-45d, booleanTrue.Result);
            Assert.AreEqual(-48d, booleanFalse.Result);
        }
Пример #3
0
        public void FloorMathWithBooleanSignificanceReturnsCorrectValue()
        {
            var function     = new FloorMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(45.6, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(45.6, false), this.ParsingContext);

            Assert.AreEqual(45d, booleanTrue.Result);
            Assert.AreEqual(0d, booleanFalse.Result);
        }
Пример #4
0
        public void FloorMathWithNoInputsReturnsPoundValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Пример #5
0
        public void FloorMathWithNumericStringModeInputReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-45.7, 4, "2"), this.ParsingContext);

            Assert.AreEqual(-44d, result.Result);
        }
Пример #6
0
        public void FloorMathWithDateAsStringModeInputReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-45.6, 3, "5/5/2017"), this.ParsingContext);

            Assert.AreEqual(-45d, result.Result);
        }
Пример #7
0
        public void FloorMathWithGeneralStringModeInputReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(34.5, 3, "string"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Пример #8
0
        public void FloorMathWithNumericStringSignificanceReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(4.67, "2"), this.ParsingContext);

            Assert.AreEqual(4d, result.Result);
        }
Пример #9
0
        public void FloorMathWithDecimalSignificanceReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(45.67, 2.34), this.ParsingContext);

            Assert.AreEqual(44.46d, (double)result.Result, 0.000001);
        }
Пример #10
0
        public void FloorMathWithDateAsStringSignificanceReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(45548564.6, "5/5/2017"), this.ParsingContext);

            Assert.AreEqual(45517320d, result.Result);
        }
Пример #11
0
        public void FloorMathWithNumericStringNumberReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs("5.67", 3), this.ParsingContext);

            Assert.AreEqual(3d, result.Result);
        }
Пример #12
0
        public void FloorMathWithDateAsStringNumberReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs("5/5/2017", 4), this.ParsingContext);

            Assert.AreEqual(42860d, result.Result);
        }
Пример #13
0
        public void FloorMathWithZeroSignificanceReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(56.7, 0), this.ParsingContext);

            Assert.AreEqual(0d, result.Result);
        }
Пример #14
0
        public void FloorMathWithZeroModeReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-5.5, 2, 0), this.ParsingContext);

            Assert.AreEqual(-6d, result.Result);
        }
Пример #15
0
        public void FloorMathWithAllThreeInputsReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(14.56, 4, 6), this.ParsingContext);

            Assert.AreEqual(12d, result.Result);
        }
Пример #16
0
        public void FloorMathWithPositiveNumberNegativeSigReturnsCorrectValue()
        {
            var function = new FloorMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(15.7, -2), this.ParsingContext);

            Assert.AreEqual(14d, result.Result);
        }
Пример #17
0
        public void FloorMathShouldReturnCorrectResult()
        {
            var func = new FloorMath();

            var args   = FunctionsHelper.CreateArgs(58.55);
            var result = func.Execute(args, _parsingContext).Result;

            Assert.AreEqual(58d, result);

            args   = FunctionsHelper.CreateArgs(58.55, 0.1);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(58.5d, result);

            args   = FunctionsHelper.CreateArgs(58.55, 5);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(55d, result);

            args   = FunctionsHelper.CreateArgs(-58.55, 1);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(-59d, result);

            args   = FunctionsHelper.CreateArgs(-58.55, 1, 1);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(-58d, result);

            args   = FunctionsHelper.CreateArgs(-58.55, 10);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(-60d, result);
        }