Beispiel #1
0
        public void WorkdayIntlWithStringsAsHolidayInputReturnsPoundValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result1   = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, 1, "testString"), this.ParsingContext);
            var result2   = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, 1, ""), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type);
            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result2.Result).Type);
        }
Beispiel #2
0
        public void WorkdayIntlWithStringInputReturnsPoundValue()
        {
            var function = new WorkdayIntl();
            var input1   = "testString";
            var input2   = "";
            var result1  = function.Execute(FunctionsHelper.CreateArgs(input1, 10), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs(input2, 10), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type);
            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type);
        }
Beispiel #3
0
        public void WorkdayIntlWithDayParameterAsGenericStringReturnsPoundValue()
        {
            var function   = new WorkdayIntl();
            var daysInput1 = "testString";
            var daysInput2 = "";
            var startDate  = new DateTime(2017, 1, 1);
            var result     = function.Execute(FunctionsHelper.CreateArgs(startDate, daysInput1), this.ParsingContext);
            var result2    = function.Execute(FunctionsHelper.CreateArgs(startDate, daysInput2), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result2.Result).Type);
        }
Beispiel #4
0
        public void WorkdayIntlWithNullFirstParamReturnsPoundNum()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs(null, 10), this.ParsingContext);

            Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #5
0
        public void WorkdayIntlDateWithSlashesFirstInputAndNegativeDateInputReturnsCorrectInput()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs("1-2-2017", -10), this.ParsingContext);

            Assert.AreEqual(42723.00, result.Result);
        }
Beispiel #6
0
        public void WorkdayIntlWithHolidaysAsStringsReturnsCorrectValue()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs("1/2/2017", 41, null, "1/25/2017"), this.ParsingContext);

            Assert.AreEqual(42795.00, result.Result);
        }
Beispiel #7
0
        public void WorkdayIntlWithNullSecondParameterReturnsPoundNA()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs("1/2/2017", null), this.ParsingContext);

            Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #8
0
        public void WorkdayIntlWithZeroFirstInputNegativeDateInputReturnsPoundNum()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs(0, -10), this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #9
0
        public void WorkdayIntlWithEmptyFirstParameterAndNegativeDateInputReturnsPoundNA()
        {
            var function = new WorkdayIntl();
            var result   = function.Execute(FunctionsHelper.CreateArgs(null, -10), this.ParsingContext);

            Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #10
0
        public void WorkdayIntlWithZeroAsDateParameterReuturnsCorrectValeue()
        {
            var function  = new WorkdayIntl();
            var startDate = new DateTime(2017, 1, 1);
            var result    = function.Execute(FunctionsHelper.CreateArgs(startDate, 0), this.ParsingContext);

            Assert.AreEqual(42736.00, result.Result);
        }
Beispiel #11
0
        public void WorkdayIntlWithPositiveArgsAndNullHolidayDatesReturnsCorrectValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, null, null), this.ParsingContext);

            Assert.AreEqual(42751.00, result.Result);
        }
Beispiel #12
0
        public void WorkdayIntlWithFractionAsStringInputReturnsCorrectValue()
        {
            var function = new WorkdayIntl();
            var input    = "0.5";
            var result   = function.Execute(FunctionsHelper.CreateArgs(input, 15), this.ParsingContext);

            Assert.AreEqual(20.00, result.Result);
        }
Beispiel #13
0
        public void WorkdayIntlWithDayParameterAsOADateReturnCorrectValue()
        {
            var function  = new WorkdayIntl();
            var startDate = new DateTime(2017, 1, 1);
            var result    = function.Execute(FunctionsHelper.CreateArgs(startDate, 42748), this.ParsingContext);

            Assert.AreEqual(102582.00, result.Result);
        }
Beispiel #14
0
        public void WorkdayIntlWithNullDayParameterReturnsPoundNA()
        {
            var function  = new WorkdayIntl();
            var startDate = new DateTime(2017, 1, 1);
            var result    = function.Execute(FunctionsHelper.CreateArgs(startDate, null), this.ParsingContext);

            Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #15
0
        public void WorkdayIntlWithDateUsingDashesInsteadOfSlashesReturnsCorrectResult()
        {
            var function = new WorkdayIntl();
            var input    = "1-2-2017";
            var result   = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext);

            Assert.AreEqual(42751.00, result.Result);
        }
Beispiel #16
0
        public void WorkdayIntlWithDATEFunctionAndNegativeDayInputReturnsCorrectResult()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, -10), this.ParsingContext);

            Assert.AreEqual(42723.00, result.Result);
        }
Beispiel #17
0
        public void WorkdayIntlWithNegativeIntAsHolidayInputReturnsPoundNum()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, 1, -1), this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #18
0
        public void WorkdayIntlWithDateAsStringAndNegativeDayInputReturnsCorrectValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = "1/2/2017";
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, -10), this.ParsingContext);

            Assert.AreEqual(42723.00, result.Result);
        }
Beispiel #19
0
        public void WorkdayIntlWithIntegerInputReturnsCorrectValue()
        {
            var function = new WorkdayIntl();
            var input    = 10;
            var result   = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext);

            Assert.AreEqual(24.00, result.Result);
        }
Beispiel #20
0
        public void WorkdayIntlWithInvalidArgumentReturnsPoundValue()
        {
            var function = new WorkdayIntl();
            var args     = FunctionsHelper.CreateArgs();
            var result   = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #21
0
        public void WorkdayIntlWithDATEFunctionAsInputReturnsCorrectValue()
        {
            var function = new WorkdayIntl();
            var input    = new DateTime(2017, 1, 2);
            var result   = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext);

            Assert.AreEqual(42751.00, result.Result);
        }
Beispiel #22
0
        public void WorkdayIntlWithNonZeroIntegerAsHolidayInputReturnsCorrectValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, 5, 1, 1), this.ParsingContext);

            Assert.AreEqual(42744.00, result.Result);
        }
Beispiel #23
0
        public void WorkdayIntlWithHolidayWithDashesInsteadOfSlashesReturnsCorrectValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 1, 2);
            var result    = function.Execute(FunctionsHelper.CreateArgs(inputDate, 41, 1, "1-25-2017"), this.ParsingContext);

            Assert.AreEqual(42795.00, result.Result);
        }
Beispiel #24
0
        public void WorkdayIntlWithIncorrectStringLengthWeekendCodeReturnsPoundValue()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2019, 5, 7).ToOADate();
            var args      = FunctionsHelper.CreateArgs(inputDate, 6, "10100");
            var result    = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #25
0
        public void WorkdayIntlWithDayParameterTypedWithQuotesReturnsCorrectResult()
        {
            var function  = new WorkdayIntl();
            var daysInput = "1/13/2017";
            var startDate = new DateTime(2017, 1, 1);
            var result    = function.Execute(FunctionsHelper.CreateArgs(startDate, daysInput), this.ParsingContext);

            Assert.AreEqual(102582.00, result.Result);
        }
Beispiel #26
0
        public void WorkdayIntlWithDecimalAsWeekendCodeReturnsPoundNum()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2013, 11, 23).ToOADate();
            var args      = FunctionsHelper.CreateArgs(inputDate, 20, 0.1);
            var result    = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #27
0
        public void WorkdayIntlFunctionWithOutOfRangeWeekendCodeReturnsPoundNum()
        {
            var function  = new WorkdayIntl();
            var inputDate = new DateTime(2017, 9, 18).ToOADate();
            var args      = FunctionsHelper.CreateArgs(inputDate, 30, 23);
            var result    = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type);
        }
Beispiel #28
0
        public void WorkdayIntlWithDayParameterWithDashInsteadOfSlashForDateReturnsCorrectValue()
        {
            var function  = new WorkdayIntl();
            var startDate = new DateTime(2017, 1, 1);
            var dayInput  = "1-13-2017";
            var result    = function.Execute(FunctionsHelper.CreateArgs(startDate, dayInput), this.ParsingContext);

            Assert.AreEqual(102582.00, result.Result);
        }
Beispiel #29
0
        public void WorkdayIntlWithValidStringWeekendCodeReturnsCorrectResult()
        {
            var function     = new WorkdayIntl();
            var inputDate    = new DateTime(2015, 12, 5).ToOADate();
            var expectedDate = new DateTime(2015, 12, 19).ToOADate();
            var args         = FunctionsHelper.CreateArgs(inputDate, 10, "1100000");
            var result       = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(expectedDate, result.Result);
        }
Beispiel #30
0
        public void WorkdayIntlWithNegativeDayArgReturndCorrectResultsWithWeekendSupplied()
        {
            var function     = new WorkdayIntl();
            var inputDate    = new DateTime(2017, 6, 25).ToOADate();
            var expectedDate = new DateTime(2017, 6, 14).ToOADate();
            var args         = FunctionsHelper.CreateArgs(inputDate, -8, 1);
            var result       = function.Execute(args, this.ParsingContext);

            Assert.AreEqual(expectedDate, result.Result);
        }