public void Days360WithIntegerInputReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs(15, 20); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(5, result.Result); }
public void Days360WithGenericStringReturnsPoundValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("string", "string"); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void Days360WithInputAsDateStringsReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("5/31/2017", "6/30/2017"); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithEuropeanDateArgumentAndDatesWrittenWithDashesInsteadOfSlashesReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("5-31-2017", "6-30-2017", true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360ShouldHandleNullFirstDateArgumentEndOfMonth() { var function = new Days360(); var endDate = new DateTime(2013, 3, 31).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(null, endDate, false), this.ParsingContext); Assert.AreEqual(40771, result.Result); }
public void Days360WithStringZeroAsMethodParameterReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("5/1/2017", "5/31/2017", "0"); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void Days360WithEuropeanDateArgumentAndIntegerArgumentsReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs(15, 20, true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(5, result.Result); }
public void Days360WithEuropeanDateArgumentAndNullSecondDateReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("5/30/2017", null, true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(-42270, result.Result); }
public void Days360WithDates0And1InStringsReturnsCorrectResult() { var func = new Days360(); var args = FunctionsHelper.CreateArgs("0", "1"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(1, result.Result); }
public void Days360WithEuropeanDateArgumentAndDatesWrittenOutAsStringsReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("31 May 2017", "30 Jun 2017", true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithEuropeanDateArgumentWithStartDateAfterEndDateReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("6/30/2017", "5/31/2017", true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(-30, result.Result); }
public void Days360WithEuropeanDateArgumentWithEmptyStringReturnsPoundValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("", "", true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void Days360WithEuropeanDateArgumentndDatesNotAStringsReturnsZero() { var function = new Days360(); var args = FunctionsHelper.CreateArgs(5 / 31 / 2017, 6 / 30 / 2017, true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(0, result.Result); }
public void Days360WithZeroAsMethodParameterReturnsCorrectValue() { var function = new Days360(); var args = FunctionsHelper.CreateArgs("5/1/2017", "5/31/2017", 0); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360ShouldHandleNullSecondDateArgumentEndOfMonth() { var function = new Days360(); var startDate = new DateTime(2013, 2, 28).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, null, false), this.ParsingContext); Assert.AreEqual(-40740, result.Result); }
public void Days360ShouldReturnCorrectResultWithEuroMethodSpecified() { var function = new Days360(); var startDate = new DateTime(2013, 1, 1).ToOADate(); var endDate = new DateTime(2013, 3, 31).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, endDate, true), this.ParsingContext); Assert.AreEqual(89, result.Result); }
public void Days360ShouldHandleFebWithEuroMethodSpecified() { var function = new Days360(); var startDate = new DateTime(2012, 2, 29).ToOADate(); var endDate = new DateTime(2013, 2, 28).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, endDate, true), this.ParsingContext); Assert.AreEqual(359, result.Result); }
public void Days360ShouldReturnCorrectResultWithNoMethodSpecifiedMiddleOfMonthDates() { var function = new Days360(); var startDate = new DateTime(1982, 4, 25).ToOADate(); var endDate = new DateTime(2016, 6, 12).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, endDate), this.ParsingContext); Assert.AreEqual(12287, result.Result); }
public void Days360ShouldHandleFebWithUsMethodSpecifiedEndOfMonth() { var function = new Days360(); var startDate = new DateTime(2013, 2, 28).ToOADate(); var endDate = new DateTime(2013, 3, 31).ToOADate(); var result = function.Execute(FunctionsHelper.CreateArgs(startDate, endDate, false), this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithDateAsMethodParameterReurnsCorrectValue() { var function = new Days360(); var dateArg = new DateTime(2017, 6, 3); var args = FunctionsHelper.CreateArgs("5/31/2017", "6/30/2017", dateArg); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithEuropeanDatesFromDateFunctionReturnsCorrectValue() { var function = new Days360(); var dateArg1 = new DateTime(2017, 5, 31); var dateArg2 = new DateTime(2017, 6, 30); var args = FunctionsHelper.CreateArgs(dateArg1, dateArg2, true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithZeroDateAnd31March1900ReturnsCorrectResult() { // Note that the Excel OADate 0 corresponds to the special date 1/0/1900 in Excel. // The Excel OADate 91 corresponds to 3/31/1900. var func = new Days360(); var args = FunctionsHelper.CreateArgs(0, 91); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(91, result.Result); }
public void Days360WithZeroDateAnd28February1900ReturnsCorrectResult() { // Note that the Excel OADate 0 corresponds to the special date 1/0/1900 in Excel. // The Excel OADate 59 corresponds to 2/28/1900. var func = new Days360(); var args = FunctionsHelper.CreateArgs(0, 59); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(58, result.Result); }
public void Days360WithGenericStringAsMethodParameterReturnsPoundValue() { var function = new Days360(); var dateArg1 = new DateTime(2017, 5, 31); var dateArg2 = new DateTime(2017, 6, 30); var args = FunctionsHelper.CreateArgs(dateArg1, dateArg2, "string"); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void Days360WithEuropeanDateArgumentAndDatesWrittenWithPeriodsInsteadOfSlashesReturnsCorrectValue() { // This functionality is different than that of Excel's. Excel does not support inputs of this format, // and instead returns a #VALUE!, however many European countries write their dates with periods instead //of slashes so EPPlus supports this format of entering dates. var function = new Days360(); var args = FunctionsHelper.CreateArgs("5.31.2017", "6.30.2017", true); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); }
public void Days360ShouldHandleFebWithUsMethodSpecified2() { var func = new Days360(); var dt1arg = new DateTime(2013, 2, 28).ToOADate(); var dt2arg = new DateTime(2013, 3, 31).ToOADate(); var result = func.Execute(FunctionsHelper.CreateArgs(dt1arg, dt2arg, false), _parsingContext); Assert.AreEqual(30, result.Result); }
public void Days360WithTrueOrFalseAsStringReturnsCorrecValue() { var function = new Days360(); var argsWithTrue = FunctionsHelper.CreateArgs("5/31/2017", "6/30/2017", "tRuE"); var argsWithFalse = FunctionsHelper.CreateArgs("5/31/2017", "6/30/2017", "false"); var resultWithTrue = function.Execute(argsWithTrue, this.ParsingContext); var resultWithFalse = function.Execute(argsWithFalse, this.ParsingContext); Assert.AreEqual(30, resultWithTrue.Result); Assert.AreEqual(30, resultWithFalse.Result); }
public void Days360ShouldReturnCorrectResultWithEuroMethodSpecified() { var func = new Days360(); var dt1arg = new DateTime(2013, 1, 1).ToOADate(); var dt2arg = new DateTime(2013, 3, 31).ToOADate(); var result = func.Execute(FunctionsHelper.CreateArgs(dt1arg, dt2arg, true), _parsingContext); Assert.AreEqual(89, result.Result); }
public void Days360WithGermanCultureReturnsCorrectValue() { var currentCulture = Thread.CurrentThread.CurrentCulture; try { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE"); var function = new Days360(); var args = FunctionsHelper.CreateArgs("30.5.2017", "30.6.2017", "TRUE"); var result = function.Execute(args, this.ParsingContext); Assert.AreEqual(30, result.Result); } finally { Thread.CurrentThread.CurrentCulture = currentCulture; } }
public void Days360FunctionWithErrorValuesAsInputReturnsTheInputErrorValue() { var func = new Days360(); var argNA = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.NA), 5); var argNAME = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Name), 5); var argVALUE = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Value), 5); var argNUM = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Num), 5); var argDIV0 = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Div0), 5); var argREF = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Ref), 5); 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); }