public override IEnumerable <IEntity> Execute(ExecutionOptions options) { var firstEvaluation = First.Execute(options); var secondEvaluation = Second.Execute(options); return(firstEvaluation.Union(secondEvaluation, EntityPathEqualityComparer.Default)); }
public void SecondShouldReturnCorrectResult() { var func = new Second(); var result = func.Execute(FunctionsHelper.CreateArgs(GetTime(9, 14, 17)), _parsingContext); Assert.AreEqual(17, result.Result); }
public void SecondShouldReturnCorrectResultWithStringArgument() { var func = new Second(); var result = func.Execute(FunctionsHelper.CreateArgs("2012-03-27 10:11:12"), _parsingContext); Assert.AreEqual(12, result.Result); }
public void SecondWithExcelEpochOADateReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs(1.0); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(0, result.Result); }
public void SecondWithDateAndTimeAsDifferentStringAsInputReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs("3/1/1900 8:47:32 PM"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(32, result.Result); }
public void SecondWithTimeOnlyAsStringReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs("6:28:48"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(48, result.Result); }
public void SecondWithDateAndTimeAsStringAsInputReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs("2013-03-27 10:11:12"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(12, result.Result); }
public void SecondWithEmptyStringAsInputReturnsPoundValue() { var func = new Second(); var args = FunctionsHelper.CreateArgs(string.Empty); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void SecondWithMaxTimeOnlyReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs(this.GetTime(23, 59, 59)); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(59, result.Result); }
public void SecondWithDateAndTimeExpressedAsStringWithUnspecifiedAMPMReturnsCorrectResult() { var func = new Second(); var args = FunctionsHelper.CreateArgs("3/1/1900 8:47:32"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(32, result.Result); }
public void SecondWithNegativeOADateAsStringAsInputReturnsPoundNum() { var func = new Second(); var args = FunctionsHelper.CreateArgs("-1.25"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)result.Result).Type); }
public void SecondWithDateTimeObjectAsInputReturnsCorrectResult() { var inputDateTime = new DateTime(1900, 3, 1, 8, 47, 32); var func = new Second(); var args = FunctionsHelper.CreateArgs(inputDateTime); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(32, result.Result); }
public void SecondWithFractionAsInputReturnsCorrectResult() { // Note that 0.27 is the Excel OADate for 1/0/1900 (the special 0-date) at 6:28:48. var func = new Second(); var args = FunctionsHelper.CreateArgs(0.27); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(48, result.Result); }
public void SecondWithOADateAsStringAsInputReturnsCorrectResult() { // Note that 61.27 is the Excel OADate for 3/1/1900 at 6:28:48. var func = new Second(); var args = FunctionsHelper.CreateArgs("61.27"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(48, result.Result); }
public void SecondWithMaxTimeValueOnOADateAsInputReturnsCorrectResult() { var inputDateTime = new DateTime(1900, 3, 1, 23, 59, 59); var func = new Second(); var args = FunctionsHelper.CreateArgs(inputDateTime.ToOADate()); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(59, result.Result); }
public override VarBase Execute() { if (ContextToExecute == null) { VarBase first = First.Execute(); VarBase second = Second.Execute(); return(Operations.FindBest(first.GetType(), second.GetType(), OperationString).Compile()(first, second)); } return(ContextToExecute.Execute()); }
public void SecondAsStringWithFractionAsInputProperlyRoundsUpToExcelEpochDate() { // 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 Second(); var args = FunctionsHelper.CreateArgs("0.999995"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(0, result.Result); }
public void SecondAsStringWithSixthDecimalPlaceProperlyRoundsDown() { // 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 Second(); var args = FunctionsHelper.CreateArgs("61.999994"); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(59, result.Result); }
public override IEnumerable <IEntity> Execute(ExecutionOptions options) { var visited = new HashSet <IEntity>(EntityPathEqualityComparer.Default); var firstEvaluation = First.Execute(options); foreach (var item in firstEvaluation) { visited.Add(item); if (Second.Match(item)) { yield return(item); } } var secondEvaluation = Second.Execute(options); foreach (var item in secondEvaluation) { if (!visited.Contains(item) && First.Match(item)) { yield return(item); } } }
public void SecondFunctionWithErrorValuesAsInputReturnsTheInputErrorValue() { var func = new Second(); 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); }