public object Execute(VariableContext context = null) { var dateExprVar = DateExpression.Execute(); if (dateExprVar is Variable dateExprOut) { switch (DateFunction) { case "date": return(DateAndTimeHelper.DateVal(dateExprOut.StringVal)); case "date and time": return(DateAndTimeHelper.DateTimeVal(dateExprOut.StringVal)); case "time": return(DateAndTimeHelper.TimeVal(dateExprOut.StringVal)); case "duration": return(DateAndTimeHelper.DurationVal(dateExprOut.StringVal)); default: throw new FEELException($"The following date function {DateFunction} is not supported"); } } throw new FEELException($"Failed executing date function {DateFunction}"); }
public void ShouldGive(params string[] expectedDates) { var expectedResults = expectedDates .Select(ParseDate) .ToArray(); foreach (var expression in _expressions) { DateExpression .Evaluate(expression) .Generate(_from, _to) .Should() .BeEquivalentTo(expectedResults, because: expression); } }
public Property Given_DateExpression_equals_left_and_left_equals_right_expression_IsEquivalentTo_should_be_true(DateExpression filterExpression, PositiveInt n) => Given_OneOfExpression_contains_the_same_epxression_repeated_many_time_When_comparing_to_that_expression_IsEquivalentTo_should_return_true(filterExpression, n.Item);
public void Given_DateExpression_equals_left_and_left_equals_right_expression_IsEquivalentTo_should_be_true(DateExpression filterExpression) => Given_FilterExpression_equals_left_and_right_IsEquivalentTo_should_return_true(filterExpression);