Example #1
0
        public void CeilingMathWithZeroModeReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-10.3, 2, 0), this.ParsingContext);

            Assert.AreEqual(-10d, result.Result);
        }
Example #2
0
        public void CeilingMathShouldReturnCorrectResult()
        {
            var func = new CeilingMath();

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

            Assert.AreEqual(16d, result);

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

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

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

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

            args   = FunctionsHelper.CreateArgs(-15.25, 10);
            result = func.Execute(args, _parsingContext).Result;
            Assert.AreEqual(-10d, result);
        }
Example #3
0
        public void CeilingMathWithNoInputsReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #4
0
        public void CeilingMathWithNegativeModeInputReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-10.4, 2, -10), this.ParsingContext);

            Assert.AreEqual(-12d, result.Result);
        }
Example #5
0
        public void CeilingMathWithStringModeInputReturnsPoundValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-10.4, 2, "string"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #6
0
        public void CeilingMathWithDoubleSignificanceReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(10.4, 5.6), this.ParsingContext);

            Assert.AreEqual(11.2d, result.Result);
        }
Example #7
0
        public void CeilingMathWithZeroSignificanceReturnsZero()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(10.4, 0), this.ParsingContext);

            Assert.AreEqual(0d, result.Result);
        }
Example #8
0
        public void CeilingMathWithDoubleNumberInputReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(10.5, 5), this.ParsingContext);

            Assert.AreEqual(15d, result.Result);
        }
Example #9
0
        public void CeilingMathWithLastTwoInputsPositiveReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(-10.5, 2, 2), this.ParsingContext);

            Assert.AreEqual(-12d, result.Result);
        }
Example #10
0
        public void CeilingMathWithMiddleNegativeInputReturnsCorrectValue()
        {
            var function = new CeilingMath();
            var result   = function.Execute(FunctionsHelper.CreateArgs(10.5, -2, 2), this.ParsingContext);

            Assert.AreEqual(12d, result.Result);
        }
Example #11
0
        public void CeilingMathWithBooleanModeInputReturnsCorrectValue()
        {
            var function     = new CeilingMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(-10.4, 2, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(-10.4, 2, false), this.ParsingContext);

            Assert.AreEqual(-12d, booleanTrue.Result);
            Assert.AreEqual(-10d, booleanFalse.Result);
        }
Example #12
0
        public void CeilingMathWithBooleanSignificanceReturnsCorrectValue()
        {
            var function     = new CeilingMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(10.5, true), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(10.4, false), this.ParsingContext);

            Assert.AreEqual(11d, booleanTrue.Result);
            Assert.AreEqual(0d, booleanFalse.Result);
        }
Example #13
0
        public void CeilingMathWithBooleanNumberInputReturnsCorrectValue()
        {
            var function     = new CeilingMath();
            var booleanTrue  = function.Execute(FunctionsHelper.CreateArgs(true, 10), this.ParsingContext);
            var booleanFalse = function.Execute(FunctionsHelper.CreateArgs(false, 3), this.ParsingContext);

            Assert.AreEqual(10d, booleanTrue.Result);
            Assert.AreEqual(0d, booleanFalse.Result);
        }