File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Castle.DynamicLinqQueryBuilder.Tests/Rules Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -2581,30 +2581,31 @@ public void BetweenDatesCultureClause()
2581
2581
2582
2582
2583
2583
//expect 4 entries to match for a Date comparison
2584
- var lastModifiedFilter = new FilterRule ( )
2584
+ var lastModifiedFilter = new JsonNetFilterRule ( )
2585
2585
{
2586
2586
Condition = "and" ,
2587
- Rules = new List < FilterRule > ( )
2587
+ Rules = new List < JsonNetFilterRule > ( )
2588
2588
{
2589
- new FilterRule ( )
2589
+ new JsonNetFilterRule ( )
2590
2590
{
2591
2591
Condition = "and" ,
2592
2592
Field = "LastModified" ,
2593
2593
Id = "LastModified" ,
2594
2594
Input = "NA" ,
2595
- Operator = "between " ,
2595
+ Operator = "in " ,
2596
2596
Type = "datetime" ,
2597
- Value = DateTime . UtcNow . Date . AddDays ( - 2 ) . ToString ( "d" , CultureInfo . InvariantCulture ) + "," +
2598
- DateTime . UtcNow . Date . ToString ( "d" , CultureInfo . InvariantCulture )
2597
+ Value = DateTime . UtcNow . Date . AddDays ( - 2 )
2599
2598
}
2600
2599
}
2601
2600
} ;
2602
- var lastModifiedFilterList = startingQuery . BuildQuery ( lastModifiedFilter ) . ToList ( ) ;
2601
+ var lastModifiedFilterList = startingQuery . BuildQuery ( lastModifiedFilter , new BuildExpressionOptions ( )
2602
+ {
2603
+ CultureInfo = CultureInfo . InvariantCulture ,
2604
+ ParseDatesAsUtc = true
2605
+ } ) . ToList ( ) ;
2603
2606
Assert . IsTrue ( lastModifiedFilterList != null ) ;
2604
- Assert . IsTrue ( lastModifiedFilterList . Count == 4 ) ;
2605
- Assert . IsTrue (
2606
- lastModifiedFilterList . Select ( p => p . LastModified )
2607
- . All ( p => ( p >= DateTime . UtcNow . Date . AddDays ( - 2 ) ) && ( p <= DateTime . UtcNow . Date ) ) ) ;
2607
+ Assert . IsTrue ( lastModifiedFilterList . Count == 0 ) ;
2608
+
2608
2609
2609
2610
//expect failure when an invalid date is encountered in date comparison
2610
2611
ExceptionAssert . Throws < Exception > ( ( ) =>
You can’t perform that action at this time.
0 commit comments