Example #1
0
        public void FactDoubleWithPositiveEvenDoubleReturnsCorrectResult()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs(4.9);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(8d, result.Result);
        }
Example #2
0
        public void FactDoubleWithTooFewArgumentsReturnsPoundValue()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs();
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Example #3
0
        public void FactDoubleWithInputAsThreeReturnsCorrectResult()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs(3);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(3d, result.Result);
        }
Example #4
0
        public void FactDoubleWithDateInStringReturnsCorrectResult()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs("1/1/1900");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(1d, result.Result);
        }
Example #5
0
        public void FactDoubleWithNegativeDoubleLessThanNegativeOneInStringReturnsPoundNum()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs("-2.5");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Example #6
0
        public void FactDoubleWithPositiveOddIntegerInStringReturnsCorrectResult()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs("5");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(15d, result.Result);
        }
Example #7
0
        public void FactDoubleWithNegativeFractionReturnsCorrectResult()
        {
            var func   = new FactDouble();
            var args   = FunctionsHelper.CreateArgs(-0.5);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(1d, result.Result);
        }
Example #8
0
        public void FactDoubleFunctionWithErrorValuesAsInputReturnsTheInputErrorValue()
        {
            var func        = new FactDouble();
            var argNA       = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.NA));
            var argNAME     = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Name));
            var argVALUE    = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Value));
            var argNUM      = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Num));
            var argDIV0     = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Div0));
            var argREF      = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Ref));
            var resultNA    = func.Execute(argNA, this.ParsingContext);
            var resultNAME  = func.Execute(argNAME, this.ParsingContext);
            var resultVALUE = func.Execute(argVALUE, this.ParsingContext);
            var resultNUM   = func.Execute(argNUM, this.ParsingContext);
            var resultDIV0  = func.Execute(argDIV0, this.ParsingContext);
            var resultREF   = func.Execute(argREF, this.ParsingContext);

            Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)resultNA.Result).Type);
            Assert.AreEqual(eErrorType.Name, ((ExcelErrorValue)resultNAME.Result).Type);
            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)resultVALUE.Result).Type);
            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)resultNUM.Result).Type);
            Assert.AreEqual(eErrorType.Div0, ((ExcelErrorValue)resultDIV0.Result).Type);
            Assert.AreEqual(eErrorType.Ref, ((ExcelErrorValue)resultREF.Result).Type);
        }