File tree Expand file tree Collapse file tree 3 files changed +224
-134
lines changed
test/System.Linq.Dynamic.Core.Tests Expand file tree Collapse file tree 3 files changed +224
-134
lines changed Original file line number Diff line number Diff line change @@ -51,4 +51,26 @@ public void Entities_OrderBy_RestrictOrderByIsTrue_InvalidExpressionShouldThrow(
5151 // Assert
5252 action . Should ( ) . Throw < ParseException > ( ) . WithMessage ( "No property or field 'IIF' exists in type 'Blog'" ) ;
5353 }
54+
55+ [ Fact ]
56+ public void Entities_OrderBy_NullPropagation_Int ( )
57+ {
58+ // Arrange
59+ var resultBlogs = _context . Blogs . OrderBy ( b => b . NullableInt ?? - 1 ) . ToArray ( ) ;
60+ var dynamicResultBlogs = _context . Blogs . OrderBy ( "np(NullableInt, -1)" ) . ToArray ( ) ;
61+
62+ // Assert
63+ Assert . Equal ( resultBlogs , dynamicResultBlogs ) ;
64+ }
65+
66+ [ Fact ]
67+ public void Entities_OrderBy_NullPropagation_String ( )
68+ {
69+ // Arrange
70+ var resultBlogs = _context . Blogs . OrderBy ( b => b . X ?? "_" ) . ToArray ( ) ;
71+ var dynamicResultBlogs = _context . Blogs . OrderBy ( "np(X, \" _\" )" ) . ToArray ( ) ;
72+
73+ // Assert
74+ Assert . Equal ( resultBlogs , dynamicResultBlogs ) ;
75+ }
5476}
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ public class User
2424
2525 public int ? NullableInt { get ; set ; }
2626
27+ public string ? NullableString { get ; set ; }
28+
2729 public int Income { get ; set ; }
2830
2931 public char C { get ; set ; }
You can’t perform that action at this time.
0 commit comments