public void MinuteShouldReturnCorrectResult()
        {
            var func   = new Minute();
            var result = func.Execute(FunctionsHelper.CreateArgs(GetTime(9, 14, 14)), _parsingContext);

            Assert.AreEqual(14, result.Result);

            result = func.Execute(FunctionsHelper.CreateArgs(GetTime(9, 55, 14)), _parsingContext);
            Assert.AreEqual(55, result.Result);
        }
        public void MinuteShouldReturnCorrectResultWithStringArgument()
        {
            var func   = new Minute();
            var result = func.Execute(FunctionsHelper.CreateArgs("2012-03-27 10:11:12"), _parsingContext);

            Assert.AreEqual(11, result.Result);
        }
Beispiel #3
0
        public void MinuteWithEmptyStringAsInputReturnsPoundValue()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs(string.Empty);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #4
0
        public void MinuteWithNegativeOADateAsStringAsInputReturnsPoundNum()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("-1.25");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #5
0
        public void MinuteWithDateAndTimeExpressedAsStringWithUnspecifiedAMPMReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("3/1/1900 8:47:32");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(47, result.Result);
        }
Beispiel #6
0
        public void MinuteWithDateAndTimeAsStringAsInputReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("2012-03-27 10:11:12");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(11, result.Result);
        }
Beispiel #7
0
        public void MinuteWithDateAndTimeAsDifferentStringAsInputReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("3/1/1900 8:47:32 PM");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(47, result.Result);
        }
Beispiel #8
0
        public void MinuteWithTimeOnlyReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs(GetTime(9, 14, 14));
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(14, result.Result);
        }
Beispiel #9
0
        public void MinuteWithTimeOnlyAsStringReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("6:28:48");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(28, result.Result);
        }
Beispiel #10
0
        public void MinuteWithExcelEpochOADateReturnsCorrectResult()
        {
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs(1.0);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(0, result.Result);
        }
Beispiel #11
0
        public void MinuteWithMaxTimeValueOnOADateAsInputReturnsCorrectResult()
        {
            var inputDateTime = new DateTime(1900, 3, 1, 23, 59, 59);
            var func          = new Minute();
            var args          = FunctionsHelper.CreateArgs(inputDateTime.ToOADate());
            var result        = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(59, result.Result);
        }
Beispiel #12
0
        public void MinuteWithFractionAsInputReturnsCorrectResult()
        {
            // Note that 0.27 is the Excel OADate for 1/0/1900 (the special 0-date) at 6:28:48.
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs(0.27);
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(28, result.Result);
        }
Beispiel #13
0
        public void MinuteWithDateTimeObjectAsInputReturnsCorrectResult()
        {
            var inputDateTime = new DateTime(1900, 3, 1, 8, 47, 32);
            var func          = new Minute();
            var args          = FunctionsHelper.CreateArgs(inputDateTime);
            var result        = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(47, result.Result);
        }
Beispiel #14
0
        public void MinuteWithOADateAsStringAsInputReturnsCorrectResult()
        {
            // Note that 61.27 is the Excel OADate for 3/1/1900 at 6:28:48.
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("61.27");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(28, result.Result);
        }
Beispiel #15
0
        public void MinuteAsStringWithFractionAsInputProperlyRoundsUpToExcelEpochDate()
        {
            // Note that Excel's max time value only goes out to 5 decimal places;
            // The 6th decimal place is rounded up if greater than or equal to 5,
            // and rounded down if less than 5.
            // 0.99999 is the date and time for 1/0/1900 (the special 0-date) at 23:59:59.
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("0.999995");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(0, result.Result);
        }
Beispiel #16
0
        public void MinuteAsStringWithSixthDecimalPlaceProperlyRoundsDown()
        {
            // Note that Excel's max time value only goes out to 5 decimal places;
            // The 6th decimal place is rounded up if greater than or equal to 5,
            // and rounded down if less than 5.
            // Without the 6th decimal place, 61.99999 is the date and time for 3/1/1900 23:59:59.
            var func   = new Minute();
            var args   = FunctionsHelper.CreateArgs("61.999994");
            var result = func.Execute(args, this.ParsingContext);

            Assert.AreEqual(59, result.Result);
        }
Beispiel #17
0
        public void MinuteFunctionWithErrorValuesAsInputReturnsTheInputErrorValue()
        {
            var func        = new Minute();
            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);
        }