public void WorkdayWithStringsAsHolidayInputReturnsPoundValue() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result1 = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, "testString"), this.ParsingContext); var result2 = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, ""), this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result2.Result).Type); }
public void WorkdayWithStringInputReturnsPoundValue() { var function = new Workday(); 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); }
public void WorkdayWithDayParameterAsGenericStringReturnsPoundValue() { var function = new Workday(); 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); }
public void WorkdayWithNullSecondParameterReturnsPoundNA() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs("1/2/2017", null), this.ParsingContext); Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayWithNullFirstParamReturnsPoundNum() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs(null, 10), this.ParsingContext); Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayDateWithSlashesFirstInputAndNegDateInputReturnsCorrectInput() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs("1-2-2017", -10), this.ParsingContext); Assert.AreEqual(42723.00, result.Result); }
public void WorkdayWithZeroFirstInputNegativeDateInputReturnsPoundNum() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs(0, -10), this.ParsingContext); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayWithEmptyFirstParameterAndNegativeDateInputReturnsPoundNA() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs(null, -10), this.ParsingContext); Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayWithHolidaysAsStringsReturnsCorrectValue() { var function = new Workday(); var result = function.Execute(FunctionsHelper.CreateArgs("1/2/2017", 41, "1/25/2017"), this.ParsingContext); Assert.AreEqual(42795.00, result.Result); }
public void WorkdayWithPositiveArgsAndNullHolidayDatesReturnsCorrectValue() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, null), this.ParsingContext); Assert.AreEqual(42751.00, result.Result); }
public void WorkdayWithZeroAsDateParameterReuturnsCorrectValeue() { var function = new Workday(); var startDate = new DateTime(2017, 1, 1); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, 0), this.ParsingContext); Assert.AreEqual(42736.00, result.Result); }
public void WorkdayWithDayParameterAsOADateReturnCorrectValue() { var function = new Workday(); var startDate = new DateTime(2017, 1, 1); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, 42748), this.ParsingContext); Assert.AreEqual(102582.00, result.Result); }
public void WorkdayWithNullDayParameterReturnsPoundNA() { var function = new Workday(); 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); }
public void WorkdayWithDateUsingDashesInsteadOfSlashesReturnsCorrectResult() { var function = new Workday(); var input = "1-2-2017"; var result = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext); Assert.AreEqual(42751.00, result.Result); }
public void WorkdayWithDateAsStringReturnsCorrectValue() { var function = new Workday(); var input = "1/2/2017"; var result = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext); Assert.AreEqual(42751.00, result.Result); }
public void WorkdayWithNegativeIntAsHolidayInputReturnsPoundNum() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(inputDate, 10, -1), this.ParsingContext); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayWithDATEFunctionAndNegativeDayInputReturnsCorrectResult() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(inputDate, -10), this.ParsingContext); Assert.AreEqual(42723.00, result.Result); }
public void WorkdayWithInvalidArgumentReturnsPoundValue() { var function = new Workday(); var args = FunctionsHelper.CreateArgs(); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void WorkdayWithIntegerInputReturnsCorrectValue() { var function = new Workday(); var input = 10; var result = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext); Assert.AreEqual(24.00, result.Result); }
public void WorkdayWithDATEFunctionAsInputReturnsCorrectValue() { var function = new Workday(); var input = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext); Assert.AreEqual(42751.00, result.Result); }
public void WorkdayWithNonZeroIntegerAsHolidayInputReturnsCorrectValue() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(inputDate, 5, 1), this.ParsingContext); Assert.AreEqual(42744.00, result.Result); }
public void WorkdayWithHolidayWithDashesInsteadOfSlashesReturnsCorrectValue() { var function = new Workday(); var inputDate = new DateTime(2017, 1, 2); var result = function.Execute(FunctionsHelper.CreateArgs(inputDate, 41, "1-25-2017"), this.ParsingContext); Assert.AreEqual(42795.00, result.Result); }
public void WorkdayWithFractionAsStringInputReturnsCorrectValue() { var function = new Workday(); var input = "0.5"; var result = function.Execute(FunctionsHelper.CreateArgs(input, 15), this.ParsingContext); Assert.AreEqual(20.00, result.Result); }
public void WorkdayWithDayParameterTypedWithQuotesReturnsCorrectResult() { var function = new Workday(); 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); }
public void WorkdayWithDayParameterWithDashInsteadOfSlashForDateReturnsCorrectValue() { var function = new Workday(); 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); }
public void WorkdayWithOADateParameterReturnsCorrectResult() { var inputDate = new DateTime(2014, 1, 1).ToOADate(); var expectedDate = new DateTime(2014, 1, 29).ToOADate(); var function = new Workday(); var args = FunctionsHelper.CreateArgs(inputDate, 20); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(expectedDate, result.Result); }
public void WorkdayShouldReturnCorrectResultWithNegativeArg() { var inputDate = new DateTime(2016, 6, 15).ToOADate(); var expectedDate = new DateTime(2016, 5, 4).ToOADate(); var func = new Workday(); var args = FunctionsHelper.CreateArgs(inputDate, -30); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(DateTime.FromOADate(expectedDate), DateTime.FromOADate((double)result.Result)); }
public void WorkdayShouldReturnCorrectResultWithFourDaysSupplied() { var inputDate = new DateTime(2014, 1, 1).ToOADate(); var expectedDate = new DateTime(2014, 1, 7).ToOADate(); var function = new Workday(); var args = FunctionsHelper.CreateArgs(inputDate, 4); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(expectedDate, result.Result); }
public void WorkdayShouldReturnCorrectResultIfNoHolidayIsSupplied() { var inputDate = new DateTime(2014, 1, 1).ToOADate(); var expectedDate = new DateTime(2014, 1, 29).ToOADate(); var func = new Workday(); var args = FunctionsHelper.CreateArgs(inputDate, 20); var result = func.Execute(args, _parsingContext); Assert.AreEqual(expectedDate, result.Result); }
public void WorkdayWithDateUsingPeriodsInsteadOfSlashesReturnsCorrectValue() { // Test case where the first parameter is a date written as a string but with '.' in place of the '/'. // This functionality is different than that of Excel's. Excel normally returns a #VALUE! when this // is entered into the function but here the date is parsed normally. var function = new Workday(); var input = "1.2.2017"; var result = function.Execute(FunctionsHelper.CreateArgs(input, 10), this.ParsingContext); Assert.AreEqual(42751.00, result.Result); }