File tree Expand file tree Collapse file tree 2 files changed +24
-18
lines changed
test/System.Linq.Dynamic.Core.Tests Expand file tree Collapse file tree 2 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public void Entities_OrderBy_RestrictOrderByIsFalse_ShouldAllowAnyExpression(str
2424 }
2525
2626 [ Fact ]
27- public void Entities_OrderBy_RestrictOrderByIsTrue_NonRestrictedExpression1ShouldNotThrow ( )
27+ public void Entities_OrderBy_RestrictOrderByIsTrue_NonRestrictedExpressionShouldNotThrow ( )
2828 {
2929 // Act 1
3030 var resultBlogs = _context . Blogs . OrderBy ( b => b . Name ) . ToArray ( ) ;
@@ -40,22 +40,7 @@ public void Entities_OrderBy_RestrictOrderByIsTrue_NonRestrictedExpression1Shoul
4040 // Assert 2
4141 Assert . Equal ( resultPosts , dynamicResultPosts ) ;
4242 }
43-
44- [ Theory ]
45- [ InlineData ( KeywordsHelper . KEYWORD_IT ) ]
46- [ InlineData ( KeywordsHelper . SYMBOL_IT ) ]
47- [ InlineData ( KeywordsHelper . KEYWORD_ROOT ) ]
48- [ InlineData ( KeywordsHelper . SYMBOL_ROOT ) ]
49- [ InlineData ( "\" Blog\" + \" Id\" " ) ]
50- public void Entities_OrderBy_RestrictOrderByIsTrue_NonRestrictedExpression2ShouldNotThrow ( string expression )
51- {
52- // Act
53- Action action = ( ) => _ = _context . Posts . OrderBy ( expression ) . ToDynamicArray < Post > ( ) ;
54-
55- // Assert 2
56- action . Should ( ) . NotThrow ( ) ;
57- }
58-
43+
5944 [ Theory ]
6045 [ InlineData ( "IIF(1 == 1, 1, 0)" ) ]
6146 [ InlineData ( "np(Name, \" x\" )" ) ]
Original file line number Diff line number Diff line change 1- using System . Linq . Dynamic . Core . Exceptions ;
1+ using System . Linq . Dynamic . Core . Parser ;
22using System . Linq . Dynamic . Core . Tests . Helpers . Models ;
3+ using FluentAssertions ;
34using Xunit ;
45
56namespace System . Linq . Dynamic . Core . Tests
@@ -38,5 +39,25 @@ public void OrderByDescending_Dynamic_AsStringExpression()
3839 //Assert
3940 Assert . Equal ( expectedDesc . ToArray ( ) , orderByIdDesc . Cast < string > ( ) . ToArray ( ) ) ;
4041 }
42+
43+ [ Theory ]
44+ [ InlineData ( KeywordsHelper . KEYWORD_IT ) ]
45+ [ InlineData ( KeywordsHelper . SYMBOL_IT ) ]
46+ [ InlineData ( KeywordsHelper . KEYWORD_ROOT ) ]
47+ [ InlineData ( KeywordsHelper . SYMBOL_ROOT ) ]
48+ [ InlineData ( "\" User\" + \" Name\" " ) ]
49+ [ InlineData ( "\" User\" + \" Name\" asc" ) ]
50+ [ InlineData ( "\" User\" + \" Name\" desc" ) ]
51+ public void Entities_OrderBy_RestrictOrderByIsTrue_NonRestrictedExpressionShouldNotThrow ( string expression )
52+ {
53+ // Arrange
54+ var queryable = User . GenerateSampleModels ( 3 ) . AsQueryable ( ) ;
55+
56+ // Act
57+ Action action = ( ) => _ = queryable . OrderBy ( expression ) ;
58+
59+ // Assert 2
60+ action . Should ( ) . NotThrow ( ) ;
61+ }
4162 }
4263}
You can’t perform that action at this time.
0 commit comments